








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to problems related to controlling systems, including finding limits as input approaches infinity and evaluating steady state errors for unit step inputs with state feedback. The document also covers adding an integral controller to the system for zero steady state error and maintaining arbitrary pole placement.
Typology: Study notes
1 / 14
This page cannot be seen from the preview
Don't miss anything!









Professor Fearing EECS C128/ME C134 Problem Set 10 Fall 2011
Given the following continuous time (CT) system
x ˙ = A 1 x + B 1 u =
x +
u(t), y = [10 0] x (1)
a) Given error e(t) = r(t) − y(t) where r(t) is a scalar, find limt→∞ e(t) for input r(t) a unit
step, and control law u(t) = r(t) − y(t).
Recall that
ess =
rss
when K is the controller gain. In this case, K = 1. Therefore:
22
1 22
5 11
ess =
6 11
rss =
6 11
b) Evaluate the steady state error limt→∞ e(t) for input r(t) a unit step, with state feedback,
that is, u = −K 1 x + r, where K 1 is chosen so that the closed loop poles are at si = − 5 , − 5.
First, find K 1. We want the eigenvalues of A 1 − B 1 K 1 to be (− 5 , −5). Find the characteristic
equation, then make it equal (s + 5)(s + 5):
k 1 k 2
− 12 − k 1 − 7 − k 2
∆(s) =
−s 1
− 12 − k 1 − 7 − k 2 − s
= s(s + 7 + k 2 ) + k 1 + 12
= s
2
= (s + 5)(s + 5) = s
2
k 1 + 12 = 25
k 1 = 13
k 2 + 7 = 10
k 2 = 3
Now find the steady state error. Note that the method we used in (a) had u = K(r − y). This
time, u = r − K 1 x. The difference is that r does not get multiplied by K 1. We need to re-derive
the steady state error relationship.
x˙ = (A 1 − B 1 K 1 )x + B 1 r
Note there’s no C 1 , because we’re doing full state feedback. Assume that ˙x = 0 in steady state.
0 = (A 1 − B 1 K 1 )xss + B 1 rss
xss = −(A 1 − B 1 K 1 )
− 1 B 1 rss
ess = rss − C 1 xss
− 1 B 1
rss
Now we can evaluate ess.
Now we can write the state and output equations.
z˙ = A 2 z + B 2 r y = C 2 z
z ˙ =
B 1 ke A 1 − B 1 K 2
w
x
r^ y^ =
w
x
z ˙ =
ke − 12 − k 1 − 7 − k 2
w
x 1
x 2
r^ y^ =
w
x 1
x 2
To find the gains K 2 , ke, find the characteristic equation for A 2 , and make it equal (s + 4)(s +
5)(s + 10):
∆(s) =
−s − 10 0
0 −s 1
ke − 12 − k 1 −s − 7 − k 2
= −s
−s 1
− 12 − k 1 −s − 7 − k 2
−s − 7 − k 2 ke
0 −s
ke − 12 − k 1
= −s(s(s + 7 + k 2 ) + 12 + k 1 ) − 10(ke)
= −s
3 − (7 + k 2 )s
2 − (12 + k 1 )s − 10 ke
We can flip the sign of ∆(s) for convenience, since we only care about its roots
= s
3
2
= (s + 4)(s + 5)(s + 10) = s
3
2
7 + k 2 = 19 ⇒ k 2 = 12
12 + k 1 = 110 ⇒ k 1 = 98
10 ke = 200 ⇒ ke = 20
Now we can evaluate the steady state error.
z˙ = A 2 z + B 2 r
0 = A 2 zss + B 2 rss
zss = −A
− 1 2 B^2 rss
yss = −C 2 A
− 1 2 B^2 rss
ess = rss − yss
− 1 2 B^2
rss
d) Augment the system matrix A 1 to include an integrator (keeping the phase variable form),
and then choose u = K 3 (r · [1 0 0]
T − x). Write the augmented state and output equations for
this system for example, z˙ = A 3 z + B 3 r, where A 3 is 3 × 3. Find gains K 3 such that the system
has closed-loop poles at s = − 4 , − 5 , − 10 , and evaluate the steady state error for a step input r(t).
Here is the signal flow diagram of the original system. Notice that we start in phase variable
form.
u
∫ x^2 ∫ x^1 y
There is only one way to add an integrator to this system that keeps the phase variable form
and that does not modify the dynamics of the original system: after x 1.
u
∫ x^2 ∫ x^1 ∫ xINT y
− 12
− 7
0
0
10
0
Notice that this new integrator doesn’t actually affect anything (both gains leading away from
xINT are zero). That’s OK; when we do full state feedback, this new state will start affecting the
rest of the system.
We can write the pre-state-feedback system equations based on this diagram:
z =
xINT
x 1
x 2
z^ ˙ = A
′ 3 z^ +^ B
′ 3 u^ =
z^ +
u
y = C 3 z =
z
Next, we have to bring the “inside loop” into A 3 , like we did in part (c). To do this, we write
Consider a pair of cars in a “platoon” regulated to a stopping position, as illustrated above. The
dynamics of car 1 are (x 2 = ¨x 1 = u 1 and car 2 has a plant model x˙ 4 = ¨x 3 = 0. 5 u 2 where u 1 and u 2
are the car’s thrust due to engine and braking. (The offset of x 1 from car 1’s rear bumper prevents
the cars from colliding when x 3 = x 1 .) The outputs of the system are y 1 = x 1 and y 2 = x 3 − x 1.
Note that if y 2 > 0 then car 2 has intruded on the safety zone of car 1.
Initial conditions are car 1 at -100 m, 20 m/s, and car 2 at -102 m, 25 m/s.
a) Write the system equations in state space form.
x ˙ 1
x ˙ 2
x ˙ 3
x ˙ 4
x 1
x 2
x 3
x 4
u 1
u 2
y 1
y 2
x 1
x 2
x 3
x 4
x(0) =
b) Use the LQR method (from Matlab function lqr(sys,Q,R), with Q=diag([2.5,10,2.5,10])
and R=diag([1,1]) to find an optimal K for the state feedback control u = −Kbx. Plot x(t) and
u(t) for the given initial condition (Matlab initial) and state feedback with gain Kb.
−
−
−
−
−
−
−
−
−
−
0
To: Out(1)
−4.5 0 1 2 3 4 5 6 7 8 9 10
−
−3.
−
−2.
−
−1.
−
−0.
0
To: Out(2)
Response to Initial Conditions
Time (seconds)
Amplitude
−100 0 1 2 3 4 5 6 7 8 9 10
−
−
−
−
0
20
t
u
Control effort
u 1 u 2
Kb =
Notice that the safety zone is violated by about 5cm at t = 7s.
c) In part b) both cars get within 1 m of the stop sign at a speed less than 1 m/s at 10 seconds.
However, car 2 lags more than 4 meters behind car 1 during the stopping trajectory. Find a new
cost function Q = diag([q 1 q 2 q 3 q 4 ]) which keeps car 2 within 2 m of car 1 for the whole trajectory,
while maintaining y 2 < 0 to prevent a collision, and distance from stop sign less than 1 m at 10
sec with velocity less than 1 m/s. (Suggestion: let q 1 = 2. 5 and q 2 = 10 and search for new q 3 and
q 4 .) Plot x(t) and u(t) for the given initial condition (Matlab initial) and state feedback with
new gain Kc.
There are many solutions that satisfy the constraints. The gray region in the following graph
shows q 3 , q 4 values that work.
6 7 8 9 10 11 12 13 14
20
25
30
35
40
45
50
55
60
Final
Safety
Distance
q
4
q 3
Taking Q=diag([2.5 10 10 40]) gives the following response:
−
−
−
−
−
−
−
−
−
−
0
To: Out(1)
−2 0 1 2 3 4 5 6 7 8 9 10
−1.
−1.
−1.
−1.
−
−0.
−0.
−0.
−0.
0
To: Out(2)
Response to Initial Conditions
Time (seconds)
Amplitude
−160 0 1 2 3 4 5 6 7 8 9 10
−
−
−
−
−
−
−
0
20
40
t
u
Control effort
u 1 u 2
Kc =
d) Find the solution to the Riccati equation P using Matlab function care(A,B,Q,R) and esti-
mate the cost J = (xT^ P x)(0) for each of b) and c).
>> dtsys = c2d(ctsys,0.4,’zoh’);
>> initial(ctsys,[1;0;0],[0:.1:4]);
>> initial(dtsys,[1;0;0],[0:.4:4]);
Continuous time response:
Zero-Order Hold Discrete time response:
b) For output feedback control u = k(r − y), sketch the root locus for the equivalent transfer
function for the continuous time (CT) system.
>> [NUM,DEN] = ss2tf(A,B,C,D)
Root locus for TF:
s + 2
s
3
2
s + 2
(s + 1)(s + 2 + 2j)(s + 2 − 2 j)
c) Determine the closed loop pole locations for the CT system for k = 5 and plot the closed-loop
step response using Matlab.
>> [z,p,k] = zpkdata(feedback(5*ss(A,B,C,D),1));
>> p{1}
ans =
-1.7285 + 2.9459i
-1.7285 - 2.9459i
-1.
>> step(feedback(5*ss(A,B,C,D),1),[0:.1:4]);
Continuous step response for system with feedback:
e) Use Matlab (iteratively if necessary) to find a sampling period T which gives a closed-loop
step response that is “reasonably close” to the CT closed-loop step response. Determine closed-loop
pole locations, and plot the DT step response.
>> step(feedback(5*c2d(ctsys,0.4,’zoh’),1))
>> step(feedback(5*c2d(ctsys,0.3,’zoh’),1))
>> step(feedback(5*c2d(ctsys,0.2,’zoh’),1))
>> step(feedback(5*c2d(ctsys,0.1,’zoh’),1),[0:.1:4])
>> [z,p,k] = zpkdata(feedback(5*c2d(ctsys,0.1,’zoh’),1));
>> p{1}
ans =
0.8159 + 0.2510i
0.8159 - 0.2510i
With sampling period of 0.1s, there is at least 8 samples for the first “hump” and the tail settles
quickly to the equilibrium value without jittering around.
Discrete step response for system with feedback (Sampling Period changed to T = 0 .1s)
f ) Briefly explain why the CT and DT ZIR responses from a) above are reasonably close, but
the closed loop responses from c) and d) (with T = 0. 4 sec) do not agree at all. (Hint, consider
e
AT .)
We know there will be some error in the open-loop responses due to discritization error. Intu-
itively, controlling the system based on an erroneous output would cause even more error in the
responses.
Lets look at a quantitative analysis of the differences:
For the discrete system:
G = e
and, in feedback,
Suppose we discretized the closed loop continous system instead so that the sampler is outside
the controller:
Gcl = e
Note how these two matrices are similar, but there are a few entries that are off by a few tenths.
In the first case, the controller is acting on observations containing discretization error, wheras
in the second case, the controller is acting continously, and then the system is discretized. The
difference in the matrices show that a controller can, in effect, amplify discretization error when
modelling a continuous system.