Solution 6.8.3.9
The root locus is shown in Figure 1. The real part of the complex poles is
Im(s)
Re(s)
-4
s + 4
s + 2
-2
Figure 1: Root locus
-3 the imaginary part is
!
d
= !
n
q
1;
2
=
3
p
1;
2
= 3:
!
n
=3
q
(2) = 4:2426
The gain that places the poles at s = ;3j3is
K = js +2jjs+4jj
s=;3+j3
=10:
The MATLAB dialogue
p1 =2
p2 = 4
zeta = 1/sqrt(2)
sigma = 3
omegad = (sigma/zeta)*sqrt(1-zeta^2)
K=1+omegad^2
1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Figure 2: Step response
omegan = sigma/zeta
s=-zeta*omegan + j* omegan *sqrt(1-zeta^2);;
sc = conj(s)
tn2 = zpk([],[s sc],omegan^2)
g=zpk([],[-p1 -p2],K)
tc = feedback(g,1)
T=linspace(0,5,200);;
[Yn2,T] = step(tn2,T);;
[Ytc,T] = step(tc,T);;
plot(T,Yn2,'k-',T,Ytc,'k--')
print -deps sr6839.eps
t=0:0.01:1;;
u=t;;
[Yrtc,t] = lsim(tc,u,t);;
[Yrn2,t] = lsim(tn2,u,t);;
plot(t,Yrn2,'k-',t,Yrtc,'k--')
print -deps rr6839.eps
plots and saves the step and ramp responses are shown in Figure 2 and 3
2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Figure 3: Ramp response
The partial fraction expansion for the step response is
C(s)=
0:5556
s
+
0:3928
6
2:3562
s +3; j3
+
0:3928
6
2:3562
s +3+j3
Then the time response is
c(t)=[0:55+ 0:7857e
;3t
cos(3t +2:3562)]1(t):
The partial fraction expansion for the ramp response is
C(s)=
;0:1852
s
+
0:5556
s
+
0:09259
6
0
s +3; j3
+
0:09259
6
0
s +3+j3
Then the time response is
c(t)=[;0:1852+ 0:5555t+0:1852e
;3t
cos(3t+2:3562)]1(t):
The complete MATLAB porgram to nd the step and ramp responses and
the partial fraction expansions is
p1 =2
p2 = 4
3
zeta = 1/sqrt(2)
sigma = 3
omegad = (sigma/zeta)*sqrt(1-zeta^2)
K=1+omegad^2
omegan = sigma/zeta
s=-zeta*omegan + j* omegan *sqrt(1-zeta^2);;
sc = conj(s)
tn2 = zpk([],[s sc],omegan^2)
g=zpk([],[-p1 -p2],K)
tc = feedback(g,1)
T=linspace(0,5,200);;
[Yn2,T] = step(tn2,T);;
[Ytc,T] = step(tc,T);;
plot(T,Yn2,'k-',T,Ytc,'k--')
print -deps sr6839.eps
t=0:0.01:1;;
u=t;;
[Yrtc,t] = lsim(tc,u,t);;
[Yrn2,t] = lsim(tn2,u,t);;
plot(t,Yrn2,'k-',t,Yrtc,'k--')
print -deps rr6839.eps
v1 = [1 0]
v2 = [1 -sc]
v3 = [1 conj(-sc)]
B= K
A=conv(v1,v2)
A=conv(A,v3)
roots(A)
[R,P,K1] = residue(B,A)
M=R(2)
absm =abs(M)
abs2m = 2*abs(M)
angm =angle(M)
t=0
dt = 0.025
kount = 1
test = R(3) +abs2m*cos(angm)
while t<5
c(kount) = R(3) +abs2m*exp(-sigma*t) *cos(sigma*t + angm);;
time(kount) = t;;
4
t=t+dt;;
kount = kount + 1;;
end
plot(time,c)
pause
v1 = [1 0]
v2 = [1 -sc]
v3 = [1 conj(-sc)]
B= K
A=conv(v1,v1)
A=conv(A,v2)
A=conv(A,v3)
roots(A)
[R,P,K1] = residue(B,A)
M=R(2)
absm =abs(M)
abs2m = 2*abs(M)
angm =angle(M)
t=0
dt = 0.025
kount = 1
test = R(3) +abs2m*cos(angm)
while t<5
c(kount) = R(3) + R(4)* t +abs2m*exp(-sigma*t) *cos(0.9338*t + angm);;
time(kount) = t;;
t=t+dt;;
kount = kount + 1;;
end
plot(time,c)
5