EE422

Solution to Lab #1 (Homework #21)

1a)

To decouple the system, we need to find the eigenvalues and eigenvectors of the A matrix:

 

» A=[0 3.1;0 -5.27]

 

A =

 

0 3.1000

0 -5.2700

 

» B=[0; 68.0164]

 

B =

 

0

68.0164

 

» C=[1 0]

 

C =

 

1 0

 

» [P,S]=eig(A)

 

P =

 

1.0000 -0.5070

0 0.8619

 

 

S =

 

0 0

0 -5.2700

 

 

 

» Bhat=inv(P)*B

 

Bhat =

 

40.0096

78.9114

 

» Chat=C*P

 

Chat =

 

1.0000 -0.5070

 

b) Draw a Block Diagram of the Decoupled System

 

eigenvalues are {0, -5.27}. System is completely controllable and observable. System is MARGINALLY stable.

 

c)

» x0=[5;5];» t=[0:.01:2];

» w=zeros(1,length(t));

» D=[0];

» [y,x]=lsim(A,B,C,D,w,t,x0);

» plot(t,x);grid;

» title('EE422- Prelab 1: Vout and Vg due to initial state of [5;5]')

» ylabel('Vout and Vg (volts)');xlabel('time (sec)')

 

2a) Using the Matlab poly() command produces:

» poly(A)

 

ans =

 

1.0000 5.2700 0

 

 

Thus, the characteristic polynomial is s2 + 5.27s + 0 = 0. Thus

 

 

b) Let's use Matlab to help us find the controllability matrix, M=[B AB], and check its rank:

 

» M=[B A*B]

 

M =

 

0 210.8508

68.0164 -358.4464

 

» rank(M)

 

ans =

 

2

 

Thus, 2 eigenvalues are controllable (which agrees with our answer to problem 1b). Since the system is completely controllable, we can find a similarity transformation to put it into phase variable form: x = Tpvzpv where Tpv = M Mpv-1 and M=[B AB] while Mpv = [Bpv ApvBpv] . Let's use Matlab to help us here:

 

» Mpv=[Bpv Apv*Bpv]

 

Mpv =

 

0 1.0000

1.0000 -5.2700

 

» Tpv=M*inv(Mpv)

 

Tpv =

 

210.8508 0

0 68.0164

 

Thus, the similarity transformation which will put the system in P.V. form is:

c) Next, using the phase variable model, let us try to design an state feedback control w = -kpvzpv such that the closed-loop system satisfies the following specifications:

 

i) asymptotically stable

ii) all real eigenvalues (no oscillation)

iii) Vout decays to within 2% of its initial value by 0.3 seconds

 

If w = -kpvzpv = -[kpv0 kpv1]zpv, then we have , which gives the following characteristic equation: s2 + (kpv1+5.27)s + (kpv0+0) = 0

From our settling time requirements of ts < 0.3 seconds we find that Re[si]max > -13.33 in order for the DECOUPLED states to decay to within 2% of their initial values by 0.3 seconds (this DOES NOT guarantee that our output will "settle" within the allotted 0.3 seconds).

 

For our initial design, let's try setting the eigenvalues to {-15,-16}. Thus, our desired characteristic equation is (s+15)(s+16) = s2 + 31s +240 = 0 = s2 + (kpv1+5.27)s + (kpv0+0) = 0

 

Equating coefficients, we find that: kpv1 + 5.27 = 31; kpv0+0 = 240

Therefore kpv1 = 25.73, and kpv0+0 = 240

w = -[kpv0 kpv1]zpv = -[241 25.73] zpv

 

Let's use Matlab to check this INTERMEDIATE result:

» Apv=[0 1;0 -5.27]

 

Apv =

 

0 1.0000

0 -5.2700

 

» Bpv=[0;1]

 

Bpv =

 

0

1

 

» Kpv=[240 25.73]

 

Kpv =

 

240.0000 25.7300

 

» eig(Apv-Bpv*Kpv)

 

ans =

 

-15

-16

 

»

As a final step, we must express our feedback control in terms of the original state vector, x, because these are the physical variables which we can tap and feedback!

This is quite simple to do because x = Tpvzpv or zpv = Tpv-1x where Tpv = M Mpv-1 and M=[B AB] while Mpv = [Bpv ApvBpv] . Let's use Matlab to help us here:

 

» K=Kpv*inv(Tpv)

 

K =

 

1.1382 0.3783

 

» eig(A-B*K)

 

ans =

 

-15.0000

-16.0000

Thus, the final feedback control is w = -Kx = -[k0 k1]x = -[ 1.1382 0.3783]x

 

Let's simulate the closed-loop system modelled by

» (A-B*K)

 

ans =

 

0 3.1000

-77.4194 -31.0000

 

» x0=[5;5];

» t=[0:.01:1];

» w=zeros(1,length(t));

» [y,x]=lsim(A-B*K,B,C,D,w,t,x0);

» plot(t,x,[0 1],0.02*[5 5],'--');grid;

» title('EE422- Prelab 1: Vout and Vg with eigenvalues at [-15,-16]')

» ylabel('Vout and Vg (volts)');xlabel('time (sec)')

As we can see, the output (Vout) takes almost 0.4 seconds to settle within 2% of the initial value of 5 volts. Let us plot the decoupled modes by finding the eigenvectors of (A-BK) then using the code suggested in the prelab:

 

As we can see, the both decoupled modes easily decay to 2% of their initial value by 0.3 seconds.

Let's go back and redesign for closed-loop eigenvalues of {-20,-22} (this is a settling time of 0.2 sec.)

 

» poly([-20 -22])

 

ans =

 

1 42 440

 

» Apv

 

Apv =

 

0 1.0000

0 -5.2700

 

» Kpv=[440 42-5.27]

 

Kpv =

 

440.0000 36.7300

 

» eig(Apv-Bpv*Kpv)

 

ans =

 

-20

-22

 

» K=Kpv*inv(Tpv)

 

K =

 

2.0868 0.5400

 

» eig(A-B*K)

 

ans =

 

-20

-22

 

Thus, using the desired eigenvalues of {-20, -22}, the final feedback control is w = -Kx = -[k0 k1]x = -[ 2.0868 0.54]x. Let's go back and simulate the closed-loop system under the influence of this new feedback control:

» x0=[5;5];

» [y,x]=lsim(A-B*K,B,C,D,w,t,x0);

» plot(t,x,[0 1],0.02*[5 5],'--');grid;

» title('EE422- Prelab 1: Vout and Vg with eigenvalues at [-20,-22]')

» ylabel('Vout and Vg (volts)');xlabel('time (sec)')

Now, Vout "settles" within the allotted 0.3 seconds.

f)