Solution 8.8.1
The rst step is to get the data into MATLAB. The MATLAB program
load mtr6step
size(mtr6step)
t=mtr6step(1:500,1);;
y=mtr6step(1:500,2);;
plot(t,y)
print -deps sr881a.eps
produces the reponse
ans =
500 2
and seperates the data into a column vector of times and a column vector
of responses, and then prints the step response
EDU>t = tfid(1:500,1);;
EDU>y = tfid(1:500,2);;
EDU>plot(t,y)
EDU>print -deps sr881a.eps
EDU>
shown in Figure`1 As can be seen the time response, whichwas taken o the
oscilloscope, does not begin exactly at t =0,andnot quite at y =0.The
MATLAB program
y(34)
y(35)
t(34)
t=t-t(34);;
y(34) = 0;;
t=t(34:500);;
y=y(34:500);;
plot(t,y)
print -deps sr881b.eps
produces the response
1
-0.05 0 0.05 0.1 0.15 0.2
-0.5
0
0.5
1
1.5
2
2.5
3
3.5
Figure 1: Rawstep response data
y34 =
-0.00437500000000
y35 =
0.00203123000000
t34 =
0.00143619000000
and produces the adjusted reponse shonwinFigure 2.
We are nowinaposition to apply the identication techniques discussed
in Chapter 3. As a rst step, the MATLAB program
max(y)
2
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
0
0.5
1
1.5
2
2.5
3
3.5
Figure 2: Adjusted step response
y1 = 3.2566 -y;;
plot(t,log(y1));;
print -deps 881lny1.eps
produces the response shown in Figure 3. Note that 3.25656 was increased
to 3.2566 to avoid ln(0).
The slope is roughly
;
[1:3;(;0:52)]
0:073
= ;24:93:
So there is a pole around s = ;25.
Our next goal is to nd B using the MATLAB program:
load mtr6step
size(mtr6step)
t=mtr6step(1:500,1);;
y=mtr6step(1:500,2);;
plot(t,y)
print -deps sr881a.eps
3
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
-12
-10
-8
-6
-4
-2
0
2
Figure 3: Plot of ln(1;y(t)
y34 =y(34)
y35 =y(35)
t34 =t(34)
t=t-t(34);;
y(34) = 0;;
t=t(34:500);;
y=y(34:500);;
plot(t,y)
print -deps sr881b.eps
s=-(1.3 -(-0.52))/0.073
max(y)
y1 = 3.2566 -y;;
plot(t,log(y1));;
print -deps 881lny1.eps
B=(y - max(y))./exp(s*t)
plot(t(100:150),B(100:150))
print -dpes 881B.eps
mean(B(100:150)
4
0.035 0.04 0.045 0.05 0.055 0.06
-4.1
-4.05
-4
-3.95
-3.9
-3.85
-3.8
-3.75
-3.7
-3.65
-3.6
Figure 4: Comparison of adjusted response and y
1
(t)=1;e
;24:9t
EDU>
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 looks to be about right B
because weknow
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
:
In the presentcase
y
2
(t)=y(t); (3:25656; 3:8992e
;24:9t
:
We then take the natural logarithm of y
2
and plot it versus time. as shown
in Figure 5. There is not a lot of information but wecanmakearough
5
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
-9
-8
-7
-6
-5
-4
-3
-2
-1
0
Figure 5: Plot of ln[y
2
(t)]
estimate of the slope to be
;
2:5
0:0225
= ;111:
Thus the second pole is somewhere around s = ;100.
Then
C = ;(A + B)=;(325656; 3:8992) = 0:64264:
Then our estimate of y(t)is
^y(t)=3:25656;38992e
;24:9t
+0:64264e
;111t
:
A comparison of y(t) and ^y(t)isshown in Figure 6. As can be seen the t
is very good.
The last taskistondK.Wehave
K
p
1
p
2
=4:9;;
whichinthe presentcasebecomes
K =3:25656 24:9111 = 9021:2:
6
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
0
0.5
1
1.5
2
2.5
3
3.5
Figure 6: Plot of ^y(t)versusy(t)
However, Figure 7 shows the armature voltage for the recorded step re-
sponse. Thus, we need to divide K by27toachieve the correct gain. Finally
G(s)=
334
(s +24:9)(s++111)
:
This is quite close to the result wegotinthis chapter using the identication
algorithm presented inthis chapter.
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
30
Figure 7: Recorded armature voltage
8