Solution 3.8.6.7
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 sr3867a.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 wehave some choices to make. We need to clean the
data up a bit to apply the identication technique described in this chapter.
First of all, weadd0.048 seconds to the t vector so that t(69) becomes 0.
Then wesety(69) equal to zero and t(69) equal to zero. Then wetruncate
the t and y vectors to the entries in locations 72 through vehundred. The
commands are:
t=t+0.048;;
t(69) = 0;;
y(69) = 0;;
t=t(69:500);;
y=y(69:500);;
plot(t,y);;
print -deps sr3867b.eps;;
1
-0.5 0 0.5 1 1.5 2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Figure 1: Rawstep response data
The adjusted response is shown in Figure 2. The rationale for the adjust-
ments is 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 four 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:048 s. Wearenowinaposition to
apply the identication techniques discussed in Chapter 3. As a rst step,
wecreate the function
y
1
= A;y(t)
and then
w(t)=ln(y(t));;
as shown bytheMATLAB dialogue:
EDU>max(y)
ans =
2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Figure 2: Adjusted step response
1.9100
EDU>y1 = 1.92-y;;
EDU>w = log(y1);;
EDU>plot(t,w)
EDU>print -deps lny1.eps
EDU>
Note that 3.98 was increased to 1.92 to avoid ln(0). The result is shown in
Figure 3. The slope is roughly
;
3:2
0:8
= ;4
So there is a pole around s = ;4.
Our next goal is to nd B using the MATLAB dialogue:
EDU>B = (y-1.92)./exp(-4*t);;
EDU>plot(t(50:75),B(50:75))
EDU>mean(B(50:75))
3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
-5
-4
-3
-2
-1
0
1
Figure 3: Plot of ln(1;y(t)
ans =
-1.9662
EDU>print -deps B.eps
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.
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:92+ 1:9662e
;4t
:
4
0.18 0.2 0.22 0.24 0.26 0.28 0.3
-2.04
-2.02
-2
-1.98
-1.96
-1.94
-1.92
-1.9
-1.88
Figure 4: Comparison of adjusted response and y
1
(t)=1;e
;0:15t
We then take the natural logarithm of y
2
and plot it versus time. as shown
in Figure 5. We showthe range of slopes. Atoneendofthe range wehave
;
4:4;2:5
0:044
= ;43:2:
In the middle of the range wehave
;
5:3;2:5
0:044
= ;63:63:
At the other end of the range wehave
;
6:4;2:5
0:042
= ;92:8:
Thus the second pole is somewhere between s = ;43 ands = ;96.
Then
C = ;(A + B)=;(1:91;1:9662) = 0:0562:
Then our estimate of y(t)is
^y(t)=1:91;1:9662e
;4t
+0:0562e
;43t
:
5
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
-8
-7
-6
-5
-4
-3
-2
Figure 5: Plot of ln[y
2
(t)]
A comparison of y(t) and ^y(t)isshown in Figure 6. As can be seen the t
is very good. It should be clear that will get essentially the same t using
anyofthe three values of p
2
that wecalculated.
The last taskistondK.Wehave
K
p
1
p
2
=1:91;;
whichinthe presentcasebecomes
K =1:91443 = 328:5:
Thus
G(s)=
328:5
(s +4)(s+43)
:
6
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Figure 6: Plot of ^y(t)versusy(t)
7