Solution 3.8.6.3
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 sr3863a.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, we add 1.1999 seconds to the t vector so that t(39) 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+1.1999;;
t(39) = 0;;
y(39) = 0;;
t=t(39:500);;
y=y(39:500);;
plot(t,y);;
print -deps sr3863b.eps;;
1
-5 0 5 10 15 20 25 30 35 40 45
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
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 5 10 15 20 25 30 35 40 45 50
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
Figure 2: Adjusted step response
4.9000
EDU>y1 = 4.91-y;;
EDU>w = log(y1);;
EDU>plot(t,w)
EDU>print -deps lny1.eps
EDU>
Note that 4.9 was increased to 4.91 to avoid ln(0). The result is shown in
Figure 3. The slope is roughly
;
3:3
20
= ;0:165:
So there is a pole around s = ;0:2.
Our next goal is to nd B using the MATLAB dialogue:
EDU>B = (y-4.9)./exp(-0.165*t);;
EDU>plot(t(50:250),B(50:250))
EDU>mean(B(50:150))
3
0 5 10 15 20 25 30 35 40 45 50
-5
-4
-3
-2
-1
0
1
2
Figure 3: Plot of ln(1;y(t)
ans =
-4.7483
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. This initial value of B is too small because
we know
jbj > jAj =4:9:
So we try
EDU>mean(B(150:200))
4
0 5 10 15 20 25
-10
-9
-8
-7
-6
-5
-4
-3
Second estimate of B
Figure 4: Comparison of adjusted response and y
1
(t)=1;e
;0:15t
ans =
-5.0380
This looks better. Having found B wecannowattempt to nd p
2
.Todo
so weform the function
y
2
(t)=y(t);(A + Be
;p
1
t
= Ce
;p
2
t
:
In the presentcase
y
2
(t)=y(t);4:9+5:038e
;0:165t
:
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
estimate of the slope to be
;
1:5
0:28
= ;5:6:
Thus the second pole is somewhere around s = ;5.
5
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-6
-5.5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
Figure 5: Plot of ln[y
2
(t)]
Then
C = ;(A + B)=;(4:9; 5:038) = 0:138:
Then our estimate of y(t)is
^y(t)=4:9;5:0382e
;0:165t
+0:138e
;5:6t
:
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 =4:9 0:165 5:6=4:53:
Thus
G(s)=
4:53
(s +0:165)(s+5:6)
:
6
0 5 10 15 20 25 30 35 40 45 50
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
Figure 6: Plot of ^y(t)versusy(t)
7