Solution 3.8.6.1
The rst step is to get the data into MATLAB. The followng commands do
that.
EDU>load tfid
EDU>size(tfid)
ans =
500 2
EDU>
the rst column is the time, and the second column is the step response.
Weusethe following commands to put the data in a form wecan plot the
step response versus time.
EDU>t = tfid(1:500,1);;
EDU>y = tfid(1:500,2);;
EDU>plot(t,y)
EDU>print -deps sr3861a.eps
EDU>
The time response is shown in Figure`1 As can be seen the time response,
whichwas taken o the oscilloscope shows negativetimebeforethe step is
applied and also the system does not start exactly at zero. The downward
trend just before t =0iswherethe switchwas thrown in the analog circuit
to initiate the step. So wehavesomechoices to make. We need to clean
the data up a bit to apply the identication technique described in this
chapter. First of all, we add 0.319989 seconds to the t vector so that t(38)
becomes zero. Then wesety(38) equal to zero and t(38) equal to zero. Then
wetruncate the t and y vectors to the entries in locations 40 through ve
hundred. The commands are:
t=t+0.319989;;
t(38) = 0;;
y(38) = 0;;
t=t(38:500);;
y=y(38:500);;
plot(t,y);;
print -deps sr3861b.eps;;
1
0 2 4 6 8 10 12 14 16 18 20
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Figure 1: Rawstep response data
The adjusted response is shown in Figure 2. The rationale for the adjust-
ments are as follows. The response was generated bycreating a second order
comepensator on the Feedback and Control box(FAC). The system response
at steady state is almost exactly one in reponse to a 1 V input. Thus, all we
wanttodoisget zero to be the pointatwhich the switchonthe FACwas
thrown to initiate the step and the response goes down close to zero. This
turns out to be approximately t = ;0:24 s. Wearenowinaposition to
apply the identication techniques discussed in Chapter 3. As a rst step,
wecreate the function A;y(t)asshown bytheMATLAB dialogue:
EDU>max(y)
ans =
1.01200000000000
EDU>y1 = 1.013-y;;
EDU>w = log(y1);;
EDU>plot(t,w)
2
0 2 4 6 8 10 12 14 16 18 20
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Figure 2: Adjusted step response
EDU>print -deps lny1.eps
EDU>
The slope of this line is
;
2:9
3:6
= ;0:8:
Thus, there is a pole in the vicintyofs = ;1.
Our next goal is to nd B using the MATLAB dialogue:
EDU>B= (y-1.012)./exp(-0.8*t);;
EDU>plot(t(1:250),B(1:250))
EDU>print -deps Ba.eps
EDU>
A plot of B versus time for o<t<10 s is shown in Figure 3. Note that we
have used the MATLAB command:
./
to do an elementbyelementdivision using twomatrices.
We see from Figure 3 that B is nearly constant out to 4s, and reasonably
constant for 4 <t<6s.Weusethe MATLAB dialogue:
3
0 1 2 3 4 5 6 7 8 9 10
-70
-60
-50
-40
-30
-20
-10
0
Figure 3: B for 0 <t<10s
EDU>mean(B(100:150))
ans =
-1.89616247864868
EDU>mean(B(1:100))
ans =
-1.08425536791520
EDU>print -deps Bb.eps
EDU>mean(B(50:200))
ans =
-2.85276785406747
4
EDU>mean(B(50:100))
ans =
-1.13470594960238
EDU>mean(B(100:125))
ans =
-1.55002798284992
EDU>mean(B(75:125))
ans =
-1.37774061572837
EDU>mean(B(75:100))
ans =
-1.21094912760319
EDU>mean(B(50:75))
ans =
-1.05752427643543
EDU>
There is a slowbysteady progression in the mean value of B.Wewould like
to be sure the eects of the second pole havedecayed out. On that basis we
would conclude that
1:05 <B<1:2:
Wechoose B =1:1.
Wenow compare the measured response to
~y(t)=1:012;1:1e
;0:8t
:
5
0 2 4 6 8 10 12 14 16 18 20
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
Figure 4: Comparison of adjusted response and ~y(t)=1:012;e
;0:8t
The comparison is shown in Figure 4.
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);1:012+ 1:1e
;0:8t
:
We then takethe natural logarithm of y
2
and plot it versus t for 0 <t<2s,
as shown in Figure 5. As can be seen, there are two distinct slopes. Figure 6
shows the plot of ln[y(t)] for 0 <t<1s. Then wecannd of range of values
for p
2
from the three slopes shown. Wehave
;
;2:24;(;3:2)
0:17
= ;4:7
;
;2:23;(;3:2)
0:25
= ;3:88
;
;2:23;(;3:52)
0:46
= ;2:8
6
0 0.5 1 1.5 2 2.5 3
-7
-6.5
-6
-5.5
-5
-4.5
-4
-3.5
-3
-2.5
-2
Figure 5: Plot of ln[y
2
(t)] for 0 <t;;3s
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-3.8
-3.6
-3.4
-3.2
-3
-2.8
-2.6
-2.4
-2.2
Figure 6: Plot of ln[y
2
(t)] for 0 <t;;1s
7
0 2 4 6 8 10 12 14 16 18 20
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
Figure 7: Plot of ^y(t)versusy(t)
Thus
2:8 <p
2
< 4:7:
Then
C = ;(A + B)=;(1:012;1:1) = 0:088:
Then our estimate of y(t)is
^y(t)=1:012;1:1e
;0:8t
+0:088e
;4:7t
:
A comparison of y(t) and ^y(t)isshown in Figure 7. As can be seen the t
is very good.
The last taskistondK.Wehave
K
p
1
p
2
=1:012;;
whichinthe presentcasebecomes
K =1:0120:84:7=3:81:
Thus
G(s)=
3:81
(s +0:8)(s+4:7)
:
8