Solution 8.8.7
The MATLAB progam
load mtr6step
size(mtr6step)
t=mtr6step(1:500,1);;
y=mtr6step(1:500,2);;
plot(t,y)
print -deps sr881a.eps
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
maxy = max(y)
y1 = 3.2566 -y;;
w=log(y1);;
plot(t,w);;
s=-(1.3 -(-0.52))/0.073
print -deps 881lny1.eps
Bv = (y - max(y))./exp(s*t);;
plot(t(100:150),Bv(100:150))
print -deps 881B.eps
B=mean(Bv(100:150))
y2 = y-(max(y) +B*exp(s*t));;
plot(t,log(y2))
print -deps 881ln2.eps
s1 = -(2.5)/0.0225
C=-(max(y) + B)
yhat = max(y) + B*exp(s*t) + C*exp(s1*t);;
plot(t,y,'k-',t,yhat,'k--')
print -deps sr881c.eps
K=max(y)*abs(s)*abs(s1)
load mtr6av
tav = mtr6av(1:500,1);;
1
av = mtr6av(1:500,2);;
plot(tav,av)
print -deps 881av.eps
Was written to solveproblem 8.8.1.
The statements
load mtr6step
size(mtr6step)
t=mtr6step(1:500,1);;
y=mtr6step(1:500,2);;
plot(t,y)
print -deps sr881a.eps
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
maxy = max(y)
y1 = 3.2566 -y;;
w=log(y1);;
plot(t,w);;
print -deps 881lny1.eps
laod the data, adjust the data so the graph begins at y(t)=0fort =0,
nds the function
y
1
(t)=y
ss
;y(t);;
and plotlny
1
(t)versus t. The slope of this line is the location of the pole
with the largest time constant.
The part of the code that weareinterested in comes immediately after
this. Once wehavefound the location of the rst pole the wecannd
B
y(t);A
e
;p
1
t
:
As discussed in the chapter, B should become relatively constantinthe time
period just before wereachsteady state. The MATLAB statements
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
Region for evaluating B
Figure 1: Root locus
s=-(1.3 -(-0.52))/0.073
print -deps 881lny1.eps
Bv = (y - max(y))./exp(s*t);;
plot(t(100:150),Bv(100:150))
print -deps 881B.eps
B=mean(Bv(100:150))
evaluate B over a range of time values.
Figure 1 Shows the adjusted time response, and the approximate region
for evaluating B.
The statement
Bv = (y - max(y))./exp(s*t);;
cancluates a vector of values of B using the
./
whichallows us to divide elements in one vector bythose in another on an
entry byentry basis. The statement
3
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 2: Plot of B for 0:04 <t<0:06
plot(t(100:150),Bv(100:150))
Then plots B versus t for 0:04 <t<0:06 s. The plot is shown in Figure 2.
The plot is jumping all over the place, because of sensor noise, but wecan
use the statement
B=mean(Bv(100:150))
to nd the mean value. We use this mean value for B in problem 8.8.1.
4