Solution 8.8.3.mtr1y The full MATLAB program used to nd the transfer function is: load mtr1step t=mtr1step(1:500,1);; y=mtr1step(1:500,2);; plot(t,y) pause y=y(51:500);; t=t(51:500);; y=y-y(1);; y(1) = 0;; t(1) = 0;; plot(t,y) print -deps sr881b.eps pause s=-(1.3 -(-0.52))/0.073 maxy = max(y) y1 = 3.2566 -y;; w=log(y1);; plot(t,w);; print -deps 881lny1.eps Bv = (y - max(y))./exp(s*t);; plot(t(100:150),Bv(100:150)) print -deps 881B.eps B=mean(Bv(100:150)) y2 = y-(max(y) +B*exp(s*t));; plot(t,log(y2)) print -deps 881ln2.eps s1 = -(2.5)/0.0225 C=-(max(y) + B) yhat = max(y) + B*exp(s*t) + C*exp(s1*t);; plot(t,y,'k-',t,yhat,'k--') print -deps sr881c.eps K=max(y)*abs(s)*abs(s1) load mtr6av tav = mtr6av(1:500,1);; av = mtr6av(1:500,2);; plot(tav,av) print -deps 881av.eps 1 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.5 1 1.5 2 2.5 3 3.5 Figure 1: Rawstep response data The rst step is to get the data into MATLAB. That is done by the MAT- LAB statements: load mtr1step t=mtr1step(1:500,1);; y=mtr1step(1:500,2);; plot(t,y) print -deps sr883mtr1ya.eps The plot of the raw date is shown in Figure1. As can be seen, the plot does not start at t =0and the initial voltage is not zero. The MATLAB statements: y=y(51:500);; t=t(51:500);; y(1) = 0;; t(1) = 0;; plot(t,y) print -deps sr883mtr1ya.eps 2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.5 1 1.5 2 2.5 3 3.5 Figure 2: Adjusted step response seperate the data into a column vector of times and a column vector of responses, and adjusts the plot so that it begins with a voltage of zero at t =0.The adjusted plot is shown in Figure2 We are nowinaposition to apply the identi cation techniques discussed in Chapter 3. As a rst step, the MATLAB statements maxy = max(y) y1 = (max(y) + 0.0001) -y;; w=log(y1);; plot(t,w);; print -deps 883mtr1lny1.eps produces the response shown in Figure 3. Note that the maximum value of y =3:0917 was increased to 0.0001 to avoid ln(0). The slope is roughly ;2 0:14 =14:2857: So there is a pole around s = ;14. Our next goal is to nd B using the MATLAB statements: 3 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -10 -8 -6 -4 -2 0 2 Figure 3: Plot of ln(1;y(t) s=-2/0.14 Bv = (y - max(y))./exp(s*t);; plot(t(100:150),Bv(100:150)) print -deps 881B.eps B=mean(Bv(100:150)) Note that wehave used the MATLAB command: ./ to do an elementbyelement division using two matrices. The plotofB versus time is shown in Figure 4. This initial estimate of B looks tobe about rightbecause wehave A =2:917 and B = ;3:1625;; and weknow that jBj > jAj Having found B we can nowattempt to nd p 2 .Todosoweform the function y 2 (t)=y(t);(A + Be ;p 1 t = Ce ;p 2 t : 4 0 0.05 0.1 0.15 0.2 0.25 -8 -7 -6 -5 -4 -3 -2 -1 0 Figure 4: Comparison of adjusted response and y 1 (t)=1;e ;24:9t In the presentcase y 2 (t)=y(t); (2:9170;3:16252e ;p 1 t ): We then take the natural logarithm of y 2 and plot it versus time. as shown in Figure 5. The inital slope is on the order of ;14, sowereallycan't gain any information about the second pole, if we believe the poles arewidely separated. The other possibilityisthat the poles are not widely seperated. Wewill address that issue as well. If we assume the poles are widely seperated, then will just havetoguess at the location of the second pole. We can nd C = ;(A + B)=;(325656; 3:8992) = 0:64264: Then our estimate of y(t)is ^y(t)=2:9170;3:1625e ;14:2857t +0:2455e ;40t ;; where wehave simply guessed at the second pole location. In the case of the motor whose transfer function weare trying to nd, we believe that the poles are widely separated. 5 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 -5 -4 -3 -2 -1 0 1 2 Figure 5: Plot of ln[y 2 (t)] Acomparison of y(t) and ^y(t)isshown in Figure 6. As can be seen the t is is better, but the recorded response is clearly quite nonlinear, and we havebeenunable to nd the second pole. The last taskisto ndK. Since K p 1 p 2 = A;; wehave, in the present case, K =2:917016p 2 : Thus, K will depend on our choice of p 2 .Ifwemake the arbitrary choice p 2 =40;; Then K =2:9170 16 40 = 1866:9: However, Figure 7 shows the armature voltage for the recorded step re- sponse. Thus, we need to divide K by24toachieve the correct gain. Finally 6 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.5 1 1.5 2 2.5 3 3.5 Figure 6: Plot of ^y(t)versusy(t) G(s)= 77:8 (s +16)(s +40) ;; where the location of the second pole is a pure guess. Wecan try to improve the model bymoving the poles around, but wewon't be very successful. For instance, the system G(s)= 182 (s +25)(s+60) gives the response shown in Figure 8 This \seems" to be an improvement, but wearenownotmatching the response in for 0:05 <t<0:15s. In, short, we cannot match the nonlinearities of the response with a linear model. We probably oughttocontent ourselves with the model G(s)= 77:8 (s +16)(s +40) : 7 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 5 10 15 20 25 Figure 7: Recorded armature voltage 8 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.5 1 1.5 2 2.5 3 3.5 Figure 8: Step response for alternativemodelwithpoles at s = ;25 and ;60 9