Solution 3.8.6.5
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 sr3865a.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 0.0454 seconds to the t and set t(39) = 0, and y(39 = 0.
Then we truncate the t and y vectors to the entries in locations 40 through
vehundred. The commands are:
t=t+0.0454;;
t(39) = 0;;
y(39) = 0;;
t=t(39:500);;
y=y(39:500);;
plot(t,y);;
print -deps sr3865b.eps;;
1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
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 1;y(t)asshown bytheMATLAB dialogue:
EDU>max(y)
ans =
0.9720
EDU>y1 = 0.973-y;;
EDU>w = log(y1);;
EDU>plot(t,w)
2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Figure 2: Adjusted step response
EDU>
The result is shown in Figure 3. The slope is roughly
;
3:8;1
0:95;0:25
= ;4:05:
So there is a pole around s = ;4. Wenowattempt to nd B.Wegenerate
B,andplot of B,with the MATLAB statements:
B=(y-0.972)./exp(-4*t);;
plot(t(100:150),B(100:150)
print -deps sr3865d.eps
Figure 4 shows a plot of B versus t for 0:4 <t<0:6. Figures 5 through 8
show the calculation of B for p
1
=4:1;;4:15;;4:2and 4.3 respectively. We
can use the MATLAB commnand:
mean(B(100:200))
std(B(100:200))
3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-7
-6
-5
-4
-3
-2
-1
0
Figure 3: Adjusted step response
0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
-1.3
-1.25
-1.2
-1.15
-1.1
-1.05
-1
-0.95
-0.9
-0.85
Figure 4: B for 0:4 <t<0:6secondsp
1
=4:0
4
0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
-1.4
-1.35
-1.3
-1.25
-1.2
-1.15
-1.1
-1.05
-1
-0.95
-0.9
Figure 5: B for 0:4 <t<0:6secondsp
1
=4:1
p
1
4 4.05 4.1 4.15 4.2 4.3
Mean -1.014 -1.045 -1.08 -1.11 -1.144 -1.215
STD 0.065 0.07 0.075 0.082 0.089 0.105
Table 1: Means and Standard deviations for various values of p
1
5
0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
-1.5
-1.4
-1.3
-1.2
-1.1
-1
-0.9
Figure 6: B for 0:4 <t<0:6 secondsp
1
=4:15
6
0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
-1.5
-1.4
-1.3
-1.2
-1.1
-1
-0.9
-0.8
Figure 7: B for 0:4 <t<0:6secondsp
1
=4:2
0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
-1.7
-1.6
-1.5
-1.4
-1.3
-1.2
-1.1
-1
-0.9
Figure 8: B for 0:4 <t<0:6secondsp
1
=4:3
7
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
Figure 9: Measured reponse versus y
1
(t)
to nd the mean and standard deviation of B. Tablel 1 summarizes this
data. If wechoose p
1
=4:05, then
B = ;1:045:
Then
C = ;(0:972;1:045) = 0:073:
We next nd
y
1
(t) = A+ Be
;4t
= 0:972;1:045e
;4t
;;
and compare it to the measured response, as shown in Figure 9. as shown
in Figure 9. The t is excellent.
We next form
y
2
(t) = y(t);y
1
(t)
= Ce
;p
2
t
;;
8
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
-8
-7
-6
-5
-4
-3
-2
Figure 10: Measured reponse versus y
1
(t)
and then plot the natural logarithm of this function verus time as shown
in Figure 10 This places the second pole somewhere between s = ;40 and
s = ;24. If wechose p
2
=24,then
K
p
1
p
2
=
K
4:0524
=0:972:
Thus
K =0:9724:0524 = 94:5
If wechose p
2
=40,then
K
p
1
p
2
=
K
4:0540
=0:972:
Thus
K =0:9724:0540 = 148:
Figures 11 and 12 compare the step response of these twotransfer functions
to the measured response. As can be seen the t is prettygoodinboth
cases.
9
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Figure 11: Measured reponse versus y
24
(t)=0:972;1:045e
;4:05t
+0:073e
;24t
By wayofreference the actual transfer function implemented was
G(s)=
150
(s+5)(s+30)
:
Weare not far o, and either transfer function would be very serviceable.
the second.
10
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Figure 12: Measured reponse versus y
24
(t)=0:972;1:045e
;4:05t
+0:073e
;40t
11