EE422
Solution to HW#16
1a) 
Let the state variables be iL1 and iL2. Therefore,

Next, to check controllability, let’s evaluate the controllability matrix, M=[b Ab … An-1b]:
which has a determinant of zero! Thus, M has no inverse and the circuit is NOT completely controllable.
b) Given the system,

c) Find the eigenvalues and eigenvectors of the A matrix. (You may use the Matlab eig() command to help you).
» a=.5*[3 -1 0;1 5 2;2 2 4]
a =
1.5000 -0.5000 0
0.5000 2.5000 1.0000
1.0000 1.0000 2.0000
» b=.5*[1;1;0]
b =
0.5000
0.5000
0
» c=[2 2 0]
c =
2 2 0
» [p,s]=eig(a)
p =
0.7071 0.2673 -0.4082
-0.7071 -0.8018 -0.4082
0.0000 -0.5345 0.8165
s =
2.0000 0 0
0 3.0000 0
0 0 1.0000
d) What is the characteristic equation of A? (You may use the Matlab poly() commands to help you). Verify the Cayley-Hamilton Theorem by substituting the matrix A into the characteristic equation.
» poly(a)
ans =
1 -6 11 -6
» 1*a^3-6*a^2+11*a-6*a^0
ans =
0 0 0
0 0 0
0 0 0
e) Use your answer to part c) to help you find a similarity transformation which will decouple the system then write the state model for the system in decoupled form.
» inv(p)*a*p
ans =
2.0000 0.0000 0.0000
0.0000 3.0000 0.0000
0.0000 0.0000 1.0000
» inv(p)*b
ans =
0.7071
-0.9354
-0.6124
» p
p =
0.7071 0.2673 -0.4082
-0.7071 -0.8018 -0.4082
0.0000 -0.5345 0.8165
» P=[p(:,1)*sqrt(2) p(:,2)*sqrt(14) p(:3)*sqrt(6)]
??? (:,2)*sqrt(14) p(:3
|
Improper function reference. A "," or ")" is expected.
» P=[p(:,1)*sqrt(2) p(:,2)*sqrt(14) p(:,3)*sqrt(6)]
P =
1.0000 1.0000 -1.0000
-1.0000 -3.0000 -1.0000
0.0000 -2.0000 2.0000
» inv(P)*a*P
ans =
2.0000 0.0000 0.0000
0.0000 3.0000 0.0000
0.0000 0.0000 1.0000
» inv(P)*B
??? Undefined function or variable 'B'.
» bhat=inv(P)*b
bhat =
0.5000
-0.2500
-0.2500
» chat=c*P
chat =
0.0000 -4.0000 -4.0000
f) Draw a block diagram for the decoupled system. What are the eigenvalues which are i) stable? ii) controllable? iii) observable?

i) All are unstable ii) All eigenvalues are controllable iii) {3,1} are observable ({2} is unobservable)
g) Find a transfer function from your decoupled block diagram. Please check that this is the same transfer function as the original system by using the Matlab ss2tf() command (be sure to cancel out any common factors in the numerator and denominator!)
From block diagram, H(s)=[(0.5x0)/(s-2) + (-1/4*-4)/(s-3) + (-1/4*-4)/(s-1)]=(2s-4)/[(s2-4s+3)]
» [num,den]=ss2tf(a,b,c,[0],1)
num =
0 2.0000 -8.0000 8.0000
den =
1 -6 11 -6
» roots(num)
ans =
2.0000
2.0000
» roots(den)
ans =
3.0000
2.0000
1.0000
» numcanceled=2*poly([2])
numcanceled =
2 -4
» dencancelled=poly([3 1])
dencancelled =
1 -4 3
H(s) = (2s-4)/(s2-4s+3)
h) Are the poles of the transfer function equal to the intersection of the controllable eigenvalues with the observable eigenvalues?
Yes
2.a) Next, go back to the original system and form the controllability matrix, M=[B AB A2B...An-1B].
» M=[b a*b a*a*b]
M =
0.5000 0.5000 0
0.5000 1.5000 5.0000
0 1.0000 4.0000
b) The rank of a Matrix is the number of linearly independent rows (or columns) of the Matrix. The rank of the controllability matrix, M, happens to be the same as the number of controllable eigenvalues. What is the rank of M (you can use Matlab's rank() command)
» rank(M)
ans =
3
c) Does your answer agree with the number of controllable eigenvalues you found in part 1f)?
Yes.
d) Using the coefficients of the characteristic equation found in 1d), find the equivalent model for the system in phase variable form (i.e., find Apv and Bpv).
» poly(a)
ans =
1 -6 11 -6
» apv=[0 1 0;0 0 1;6 -11 6]
apv =
0 1 0
0 0 1
6 -11 6
» bpv=[0;0;1]
bpv =
0
0
1
e) Verify that Apv has the same characteristic equation as the original A matrix (you can use the poly() command).
» poly(apv)
ans =
1.0000 -6.0000 11.0000 -6.0000
f) If the system is completely controllable (i.e., no uncontrollable eigenvalues), we can find a valid similarity transformation, Tpv = M Mpv-1 to transform it into phase variable form by using the relation x= Tpvzpv where Mpv =[Bpv ApvBpv Apv2Bpv ...Apvn-1Bpv]. Find Tpv and verify that
is indeed in phase variable form.
» Mpv=[bpv apv*bpv apv*apv*bpv]
Mpv =
0 0 1
0 1 6
1 6 25
» Tpv=M*inv(Mpv)
Tpv =
2.5000 -2.5000 0.5000
1.5000 -1.5000 0.5000
-2.0000 1.0000 0
» inv(Tpv)*a*Tpv
ans =
0.0000 1.0000 0.0000
0.0000 0.0000 1.0000
6.0000 -11.0000 6.0000
» inv(Tpv)*b
ans =
0.0000
0.0000
1.0000
g) Using your model in phase variable form, find a full state feedback control, w = -Kpvzpv = - [kpv0 kpv1 kpv2]zpv such that the closed-loop eigenvalues are {-2 -4 -5}
» poly([-2 -4 -5])
ans =
1 11 38 40
» kpv=[ans(4)+apv(3,1) ans(3)+apv(3,2) ans(2)+apv(3,3)]
kpv =
46 27 17
» eig(apv-bpv*kpv)
ans =
-2.0000
-4.0000
-5.0000
h) Finally, transform your feedback control back to the original state coordinates by using w = -KpvTpv-1x.
» K=kpv*inv(Tpv)
K =
-151.0000 185.0000 -73.0000
i) Let K= KpvTpv-1. Thus, the feedback control is w=-Kx and the closed-loop state model is
. Complete the following closed-loop vector block illustrating this feedback:

j) Check that your design is correct by finding the eigenvalues of A-BK. What is the settling-time of the closed-loop system
» eig(a-b*K)
ans =
-5.0000
-4.0000
-2.0000