0% found this document useful (0 votes)
64 views11 pages

Solution To HW9

This document provides solutions to homework problems from an ECE/ME course. It solves problems related to determining state feedback gains to achieve desired closed-loop performance, placing characteristic roots of a closed-loop system, and checking the controllability and observability of a system. MATLAB scripts are provided to simulate and verify the solutions. Key steps and results are shown, but some intermediate calculations are omitted for brevity.

Uploaded by

Andreina Balluno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views11 pages

Solution To HW9

This document provides solutions to homework problems from an ECE/ME course. It solves problems related to determining state feedback gains to achieve desired closed-loop performance, placing characteristic roots of a closed-loop system, and checking the controllability and observability of a system. MATLAB scripts are provided to simulate and verify the solutions. Key steps and results are shown, but some intermediate calculations are omitted for brevity.

Uploaded by

Andreina Balluno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 1

Solution to HW9
AP11.1 We are given a system with open loop transfer function
   
X1 (s) X1 (s) X2 (s) X3 (s)
G(s) = = (1)
U (s) X2 (s) X3 (s) U (s)
   
1 2 2K 4K
= = , (2)
s s+1 s+4 s(s + 1)(s + 4)
and all states available for measurement (so we can design a full-state feedback controller).
We are asked to select feedback gains so that the system has steady state error of zero in
response to a step input and less than 3 percent overshoot.
Solution:
At first glance, the problem statement is a little confusing. We are asked to select “gains”
when we have a single gain “K” in the transfer function. However, we can see what is
meant by noting that the transfer function G(s) = X1 (s)/U (s) and that with full-state
feedback we will have a gain matrix K = [k1 , k2 , k3 ] such that u(t) = r(t) + Kx(t) =
r(t) + k1 x1 (t) + k2 x2 (t) + k3 x3 (t).
From the block diagram shown in Figure AP11.1 on page 714 of the text, we see that

ẋ1 = x2 (3)
ẋ2 = −x2 + 2x3 (4)
ẋ3 = −4x3 + 2Ku (5)

so substituting for u we find that in state space form we have the system
   
0 1 0 0
ẋ =  0 −1 2 x+  0 r (6)
2Kk1 2Kk2 2Kk3 − 4 2K
y = [1 0 0] x. (7)

The closed loop transfer function is then

T (s) = CΦ(s)B = [1 0 0] (sI − A)−1 B. (8)

Using Maple or computing by hand yields


 2 
s + (5 − 2Kk3 )s + 4 − 2Kk3 − 4Kk2 s + 4 − 2Kk3 2
1 
Φ(s) = 4Kk1 s(s + 4 − 2Kk3 ) 2s  (9)
∆(s)
2Kk1 s + 2Kk1 2Kk2 s2 Kk1 s(s + 1)

where
∆(s) = s3 + (5 − 2Kk3 )s2 + (4 − 2Kk3 − 4Kk2 )s − 4Kk1 . (10)
Premultiplication by C selects the first row of Φ(s) and postmultiplication by B then
selects the third element and multiplies it by 2K so
4K
T (s) = . (11)
s3 + (5 − 2Kk3 )s2 + (4 − 2Kk3 − 4Kk2 )s − 4Kk1
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 2

The steady state error to a step will be


 
1 1
ess = lim s (1 − T (s)) = 1 − T (0) = 1 + (12)
s→0 2 k1

thus to obtain zero steady state error for a step input we need k1 = −1.
Now we have an underconstrained problem. There are many triples of values (K, k2 , k3 )
that will yield the appropriate overshoot. Suppose we choose ζ = 0.75 and ωn = 1 to
obtain characteristic polynomial

p(s) = (s2 + 2ζωn s + ωn2 )(s + ωn ) (13)


3 2
= s + (2ζ + 1)ωn s + ωn2 (2ζ + 1)s + ωn3 (14)
3 2
= s + 2.5s + 2.5s + 1. (15)

Then (K, k2 , k3 ) = (1/4, −1, 5) results in the denominator of T (s) matching p(s).
Testing our results in Matlab (we could do this by hand, using the Laplace transform, of
course, but we won’t) yields the step response shown in Figure 1. The overshoot is 0.7
percent, satisfying the design requirement. The Matlab script is shown below.

%
% AP11_1.m solves part of problem AP11_1 from Dorf and Bishop 10th ed.
%
% 1 May 05 --sk
%
clear all

k1 = -1;
K = 1/4;
% First solve y = Mq+b for q = [k2,k3]
M = [0 -2*K;-4*K -2*K];
b = [5;4];
y = [5/2;5/2];
q = M\(y-b)
k2 = q(1) %%% = -1;
k3 = q(2) %%% = 5;
% Now define the closed loop transfer function T(s)
Tcl = tf([4*K],[1 5-2*K*k3 4-2*K*k3-4*K*k2 -4*K*k1])
t = [0:.01:20]’;
y = step(Tcl,t);
figure(1)
plot(t,y)
grid
title(’Closed-Loop Step Response for AP11.1’)
xlabel(’Time (s)’)
ylabel(’Position x_1(t)’)
print -deps ap11_1
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 3

Figure 1: Step Response for AP11.1


Closed−Loop Step Response for AP11.1
1.4

1.2

0.8
Position x1(t)

0.6

0.4

0.2

0
0 2 4 6 8 10 12 14 16 18 20
Time (s)

% check to see whether the percent overshoot requirement is satisfied


po = (max(y)-1)/1

AP11.4 We are given the state space system


   
0 1 0 0 0
 0 0 −1 0   1 
ẋ = 
 0 0
x +  u (16)
0 1   0 
0 0 9.8 0 −1

having full-state feedback and asked to place the characteristic roots of the closed-loop
system at s = −2 ± j, −5, and −5.
Solution: The desired characteristic polynomial is

p(s) = (s+2+j)(s+2−j)(s+5)2 = (s2 +4s+5)(s2 +10s+25) = s4 +14s3 +70s2 +150s+125.


(17)
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 4

The closed-loop matrix Acl = A − BK is


 
0 1 0 0
 −k1 −k2 −k3 + 1 −k4 
Acl =   (18)
 0 0 0 1 
k1 k2 −9.8 + k3 k4

so we see that we will not want to find the determinant of sI − Acl , and instead use
Ackermann’s formula. This is easily automated in a Matlab script as shown below and
yields characteristic polynomial coefficients and gain matrix K as follows

ps =

1 14 70 150 125

K =

-14.2045 -17.0455 -94.0045 -31.0455

and the feedback control law will be u = −Kx. Here’s the script.

%
% AP11_4.m solves part of problem AP11_4 from Dorf and Bishop 10th ed.
%
% 1 May 05 --sk
%
clear all

A = [0 1 0 0;
0 0 -1 0;
0 0 0 1;
0 0 9.8 0];
B = [0,1,0,-1]’;
Pc = [B A*B A*A*B A*A*A*B]
ps = conv(conv([1 2+i],[1 2-i]),[1 10 25])
K = [0 0 0 1]/Pc*(ps(1)*A^4+ps(2)*A^3+ps(3)*A^2+ps(4)*A + ps(5)*eye(4))

MP11.2 We are given a system


   
0 1 0
ẋ = x+ u (19)
−2 −4.5 1
y = [1 0] x. (20)

and asked to determine whether the system is controllable and observable. We are also
asked to find the transfer function from u to y.
Solution:
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 5

We can check controllability and observability easily enough by hand, finding that
 
0 1
Pc = [B AB] = (21)
1 −4.5
   
C 1 0
Po = = (22)
CA 0 1
(23)

from which we immediately see that both matrices have full rank and the system is con-
trollable and observable.
We can also easily compute the transfer function by hand. It is

G(s) = C(sI − A)−1 B (24)


  
s + 4.5 1 0 1
= [1 0] 2
(25)
−2 s 1 s + 4.5s + 2
1
= 2 . (26)
s + 4.5s + 2

MP11.7 We are given the system


 
0 1 0
ẋ =  0 0 1 x (27)
−2 −4 −6
y = [1 0 0] x. (28)

having no input. We are also given three observations of y, namely

y(0) = 1 y(2) = −0.0256 y(4) = −0.2522. (29)

We are asked to (a) develop a method for determining the initial condition x(t0 ) (meaning
any t0 — not just t0 = 0), (b) compute x(t0 ) in terms of the observations and comment
on conditions under which this is possible, and (c) test the prediction in Matlab.
Solution: Since there is no input,

x(t) = eA(t−t0 ) x(t0 ), ∀t ≥ t0 . (30)

Thus
Ce(4−t0 )A
   
y(4)
 y(2)  =  Ce(2−t0 )A  x(t0 ) (31)
y(0) Ce(0−t0 )A
and we can solve for the initial condition x(t0 ) so long as the matrix premultiplying it is
invertible.
We compute x(0) and six values of y(t) integer times 0 through 5, using the following
Matlab script.
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 6

%
% MP11_7.m solves part of problem MP11_7 from Dorf and Bishop 10th ed.
%
% 1 May 05 --sk
%
clear all

A = [0 1 0;
0 0 1;
-2 -4 -6];
C = [1 0 0];

y = [1;-0.0256;-0.2522];
ts = [0 2 4]’;
M = [C*expm(ts(1)*A);C*expm(ts(2)*A);C*expm(ts(3)*A)];
x = M\y

B = [0 0 0]’;
D = 0;
t=[0:1:5];
ysim = lsim(A,B,C,D,0*t,t,x)

The output of the script is shown below.

>> mp11_7

x =

1.0000
-1.0000
1.9998

ysim =

1.0000
0.3596
-0.0256
-0.2136
-0.2522
-0.2051

It can be seen that the values of y(0), y(2), and y(4) match those given in the problem
statement.
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 7

MP11.11 We are given the system


   
0 1 0 0
ẋ =  0 0 1 x+  0  (32)
−4.3 −1.7 −6.7 0.35
y = [0 1 0] x + 0u. (33)

We are asked to (a) use the acker function to determine the full-state feedback gain matrix
and observer gain matrix to place the closed-loop system poles at s1,2 = −1.4 ± 1.4j,
s3 = −2, and the observer poles at s1,2 = −18 ± 5j , s3 = −20, (b) construct the state
variable compensator, (c) simulate the behavior of the closed-loop system for initial system
state x(0) = [1 0 0]′ and initial estimator state x̂ = [0.5 0.1 0.1]′ .
Solution:
First, we check to see whether the system is controllable and observable. Finding that it is,
we execute the following Matlab script to obtain the controller gain K = [10.11 22.34 −
5.43] and observer gain L = [−1622 49.3 737]′ and plot the system behavior for the given
initial conditions.
The system behavior is shown in Figure 2. Note that as expected, since we placed the
poles of the observer roughly an order of magnitude farther from the origin than those of
the controller, the estimates converge faster than the states.
The Matlab script is given below.

%
% MP11_11.m solves part of problem MP11.11 from Dorf and Bishop 10th ed.
%
% 1 May 05 --sk
%
clear all

A = [0 1 0;
0 0 1;
-4.3 -1.7 -6.7];
B = [0 0 0.35]’;
C = [0 1 0];
D = 0;

sp = [-1.4+1.4*i -1.4-1.4*i -2]’;


so = [-18+5*i -18-5*i -20]’;

K = acker(A, B, sp)
L = acker(A’, C’, so)’

% combined system matrices


Ac = [A-B*K B*K;0*A A-L*C];
Bc = [0*B;0*B];
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 8

Figure 2: Response of Closed-Loop System of MP11.11


Time Response for MP11.11 with Initial Condition [1 0 0 0.5 0.1 0.1]T
3
x1(t)
x2(t)
2.5
x (t)
3
e1(t)
2 e2(t)
e3(t)
1.5

0.5

−0.5

−1

−1.5
0 1 2 3 4 5 6 7 8 9 10
Time (s)

Cc = eye(6);
Dc = [0 0 0 0 0 0]’;
t = [0:.01:10]’;
x0 = [1 0 0]’;
xhat0 = [0.5 0.1 0.1]’;
xc0 = [x0;xhat0];
ysim = lsim(Ac,Bc,Cc,Dc,0*t,t,xc0);
plot(t,ysim)
title(’Time Response for MP11.11 with Initial Condition [1 0 0 0.5 0.1 0.1]^{T}’)
xlabel(’Time (s)’)
legend(’x_1(t)’,’x_2(t)’,’x_3(t)’,’e_1(t)’,’e_2(t)’,’e_3(t)’)
print -depsc mp11_11
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 9

MP11.13 We are given the system


   
0 1 0 0 0
 0 0 1 0   0 
ẋ =  x+   (34)
 0 0 0 1   0 
−2 −5 −1 −13 1
y = [1 0 0 0] x + 0u. (35)

and asked to (a) place the closed-loop system poles at s1,2 = −1.4 ± 1.4j, s3,4 = −2 ± j,
and the observer poles at s1,2 = −18± 5j , s3,4 = −20, (b) use Simulink to simulate system
response for a variety of initial states, displaying the output on an xy-graph.
Solution:

(a) The controller and observer gains are computed using the Matlab commands
clear all

A = [0 1 0 0;
0 0 1 0;
0 0 0 1;
-2 -5 -1 -13];
B = [0 0 0 1]’;
C = [1 0 0 0];
D = 0;

sp = [-1.4+1.4*i -1.4-1.4*i -2+i -2-i]’;


so = [-18+5*i -18-5*i -20 -20]’;

K = acker(A, B, sp)
L = acker(A’, C’, so)’
to be
>> mp11_13

K =

17.6000 24.6800 19.1200 -6.2000

L =

63
1369
10495
1479
(b) Using Simulink is optional here. The system is so simple that there’s really not much
point. I used a Matlab script to generate the response to a mismatched set of initial
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 10

conditions (the second element of x is one while the third element of hatx is one and
all other elements are zero). The result is shown in Figure 3. Responses to other
initial conditions can be easily generated using the Matlab script below. The Matlab

Figure 3: Response of Closed-Loop System of MP11.13


T
Time Response for MP11.13 with Initial Condition [0 1 0 0 0 0 1 0]
2
x (t)
1
x (t)
2
x (t)
3
1
x (t)
4
e (t)
1
e (t)
2
0 e (t)
3
e (t)
4

−1

−2

−3

−4
0 1 2 3 4 5 6 7 8 9 10
Time (s)

script is as follows.
%
% MP11_13.m solves part of problem MP13.11 from Dorf and Bishop 10th ed.
%
% 1 May 05 --sk
%
clear all

A = [0 1 0 0;
0 0 1 0;
0 0 0 1;
-2 -5 -1 -13];
ECE382/ME482 Spring 2005 Homework 9 Solution May 1, 2005 11

B = [0 0 0 1]’;
C = [1 0 0 0];
D = 0;

sp = [-1.4+1.4*i -1.4-1.4*i -2+i -2-i]’;


so = [-18+5*i -18-5*i -20 -20]’;

K = acker(A, B, sp)
L = acker(A’, C’, so)’

% combined system matrices


Ac = [A-B*K B*K;0*A A-L*C];
Bc = [0*B;0*B];
Cc = eye(8);
Dc = [0 0 0 0 0 0 0 0]’;
t = [0:.01:10]’;
x0 = [0 1 0 0]’;
xhat0 = [0 0 1 0]’;
xc0 = [x0;xhat0];
ysim = lsim(Ac,Bc,Cc,Dc,0*t,t,xc0);
figure(1)
clf
plot(t,ysim)
grid
title(’Time Response for MP11.13 with Initial Condition [0 1 0 0 0 0 1 0]^{T}’)
xlabel(’Time (s)’)
legend(’x_1(t)’,’x_2(t)’,’x_3(t)’,’x_4(t)’,’e_1(t)’,’e_2(t)’,’e_3(t)’,’e_4(t)’)
print -depsc mp11_13

You might also like