ECEEN 5448 Fall 2 Homework #4 Solutions Professor David G. Meyer Novemeber 29, 2. The state-space realization is A = [ [ ; b = ; c = [ which describes, of course, a free mass (in normalized units) with input being a force on the mass and output being the position. The states are the mass position and velocity. (a) Demonstrate the transfer function is /s 2. This shows the realization is controllable and observable (why)? si A = [ s s (si A) b = s 2 [ s s c(si A) b = s 2 [ [ s (si A) = [ s s 2 s [ (si A) b = [ s 2 s = s 2 This shows controllability and observability because no cancellations (b) Find the state-feedback gain k that makes det (si A + bk)) = s 2 +5s +6 ([ ) s det (si A + bk) =det = s 2 + k k s + k2 2 s + k So answer is k = [6 5. (c) Find the closed-loop transfer function H yr (s) with the control u = kx + r operating and k being the gain vector you found in b. Zeros don t move, new denominator is det (si A + bk) (d) With the initial condition H yr (s) =c (si A + bk) b = x() = s 2 +5s +6 = (s + 2)(s +3) Find the response y(t) if r and sketch it. (No computer plots, please; just sketch the thing. You can use MATLAB to plot it st if you want and then sketch from the plot). [ ẋ =(A bk)x; y = cx Y (s) =c(si A + bk) x = And so My sketch shown in Figure y(t) =e 2t e 3t (s + 2)(s +3) = s +2 s +3
2 Figure : Sketch of y(t) when u = kx and x() = [ T (e) Now find the observer gain l that makes det (si A + lc)) = s 2 +25s + 5. Dual problem to finding k. Answer is [ 25 l = 5 (f) With the control u = kˆx + r operating where ˆx is, of course, the observer state, find the response y(t) ifr and [ x() = ˆx() = No observer mis-match to start here, so x(t) for all time and response will be same as in d. y(t) =e 2t e 3t (g) Now with u = kˆx + r operating and r find the response y(t) if [ [ x() = and ˆx() = Here x() = x() ˆx() = [ Closed loop state space equations, for r are [ [ [ d x(t) A bk bk x(t) = ; y = [ c [ x(t) dt x(t) A lc x(t) x(t) and so Y (s) = [ c ([ si A + bk bk si A + lc We recall [ A B C and so [ A A = BC C ) [ x() x() Y (s) =c (si A + bk) x() + c (si A + bk) bk (si A + lc) x() }{{} dynamics caused by x() and so we see, explicitly the extra dyanamics in the response when estimated state-feedback is used and the observer error is not initially zero. Y (s) = = (s + 2)(s +3) + 5s + 3 (s + 2)(s +3) (s + )(s + 5) = s 2 +3s + 28 (s + 2)(s + 3)(s + )(s + 5) 225 4(s +2) 5 2(s +3) + 8 28(s + ) 4 95(s + 5)
and so y(t) = 225 4 e 2t 5 2 e 3t + 8 28 e t 4 95 e 5t The two responses, for u = kx and u = kˆx are plotted with MATLAB in Figure 2. The response that peaks higher is the one with u = kˆx..35.3.25.2.5..5.5.5 2 2.5 3 Figure 2: Response to x() = [ T when u = kx and when u = kˆx and ˆx() =
4 2. Given the -dimensional system ẋ = x+u with x() = x, you will find the control u(t) which minimizes u2 (t) dt subject to the constraint that lim t x(t) = using two different approaches. First you will do it via LQR theory and and then you will do it by the theory of pseudo-inverses. (a) Setup the LQR problem of minimizing J ɛ (x,u)= ɛx 2 (t) +u 2 (t) dt where ɛ>. Formulate the associated ARE and find its unique, positive-definite solution, P. The ARE is 2p p 2 + ɛ = p = 2 ± 4+4ɛ 2 and picking the positive definite solution shows p =+ +ɛ (b) From (2a) above, compute u ɛ (t) the optimal state feedback minimizing J ɛ. Verify that A bk has LHP eigenvalues (so, for this -dimensional example, verify that A bk has negative real part.) The optimal feedback gain is b T P/ρ =+ +ɛ so here the optimal control is u ɛ (t) = ( + +ɛ)x(t) This makes A bk = ( + +ɛ) = +ɛ which is clearly in the LHP. (c) Now let ɛ in order to find the control, u (t), which minimizes u 2 (t) dt subject to lim t x(t) = Taking ɛ to zero gives u (t) = 2x(t) This control flips the unstable pole across the jω-axis which is a solution we expect. (d) Show that a control u L 2 [,T yields x(t )=iffl[u = e T x where L[u = e A(T τ) bu(τ) dτ is the usual input to final-state map studied in class and the final time T>is given and fixed. The solution to ẋ = Ax + bu, x() = x is so x(t )=means x(t) =e At x + t e A(t τ) bu(τ) dτ =e AT x + e A(T τ) bu(τ) dτ which means L[u = e AT x Here A =, of course, so the condition is L[u = e T x. (e) Let L be the adjoint of L. Find an expression for L [x. x, L[u = L [x,u x T e A(T τ) bu(τ) dτ = x T e A(T τ) b = (L [x(τ)) T L [x =b T e AT (T τ) x For our system, A =, and b =so L [x(t) =e T t x (L [x(τ)) T u(τ) dτ
5 (f) Let L denote the pseudo-inverse of L. Find L [x. Plugging in and so LL [x = e A(T τ) bb T e AT (T τ) xdτ = { [ L [x(t)= b T e AT (T t) e Aτ bb T e AT τ xdτ } e Aτ bb T e AT τ dτ x In our case, for A =and b =this is { [ } { } L [x(t) = e (T t) e 2τ (T t) 2e dτ x = e 2T x () (g) Using your psuedo-inverse, explicitly find the the control, u T (t) which minimizes u2 (t) dt subject to x(t )= A control takes use to x(t )=if, and only if L[u = e T x. The minimum norm solution to this system of linear equations is u T (t) =L [ e T x. Using our expression for L this becomes { } 2e (T t) u T (t) = e 2T e T x (2) (h) Verify that as T u T (t) u (t) from part (2c). It is NOT enough to simply take T in (2) and show you get 2e t x!! If you did only this, you get zero for this problem and a wrist slap for being sloppy. { } Instead apply u T (t) = 2e (T t) e T x e 2T to the system ẋ = x + u, x() = x and we get and so while 2x(t) is x(t) = e t x 2e2T e 2T x [ ( 2e = e t 2T + e 2T t e (t τ) (e τ ) dτ ) e t ( e 2t 2 u T (t) = 2e2T ( e t ) e 2T x ) x [ 2e t e 2T (e 2T ) + ( 2e 2T ) e t ( e 2t ) x ( e t ) ( e x [e 2t 2T = 2e2T e 2T e 2T = 2e2T ( e t ) [ e 2T e 2t e 2T x e 2T [ e 2T e 2t = u T (t) e 2T ) +( e 2t ) and NOW we can see that as T the bracketed term in (3) goes to for any finite t and thus lim T u T (t) = lim T 2x(t) where x(t) is solution to ẋ(t) =x(t)+u T (t), x() = x (3)
6 [ 2 3. Suppose P = 2 (a) If x T x how big can x T Px be? Why? Eigenvalues of P are, 3. Minimax theory says x T Px λ max (P )x T x and so x T Px 3 when x T x (b) If x T x = how small can x T Px be? Why? Similar. Now λ min (P ) comes into play. Minimax theory says x T Px λ min x T x and so x T Px when x T x =because here λ min (P )=. Thus smallest it can be is.
7 4. Proof or counterexample. You may assume all PD matrices are also symmetric. (a) If P is n n and PD and P 2 is n n and PD, then P P 2 + P 2 P is PD. This seems fishy since x T (P P 2 + P 2 P )x = x T P P 2 x + x T P 2 P x =2x T P P 2 x and we saw last HW that product doesn t preserve PD. In fact P = [ 2 2 5 and P 2 = [ 2 2 is one counter-example. (b) If U and V are orthogonal matrices of size n n, then so are UV and VU. This is true. Proofs are easy. (UV) T UV = V T U T UV = V T V = I and UV(UV) T = UVV T U T = UU T = I. This shows UV is orthogonal. The proof about VU is similarly easy. (c) For any two n n matrices A and B, (si A) (si B) =(si A) (A B)(sI B). (If true, what does this say about parallel and cascade connections of transfer functions?) This is true. Hence (si A) (si B) = (si A) [(si B) (si A) (si B) = (si A) (A B)(sI B) c(si A) b c(si B) b = c(si A) (A B)(sI B) b and so the parallel connection of two transfer functions with the same c and b vectors can be represented as a cascade connection of a multi-output transfer function with the B and b dynamics and a multi-input transfer function with the c and A.
5. Consider the mass-spring damper system shown in Figure 3 of a mass M sliding on a fritionless surface, connected by a spring and a damper to an immovable wall. We can apply an external force, u to the mass as shown. With output y = q and using the natural, physical state K B M q u Figure 3: Two Masses Connected by a Linear Spring x = [ q q a state-space realization for the system is [ A = K/M B/M [ ; b = /M ; c = [ Let us suppose M = 6, K = 2 and B = 3 for the rest of this problem. (a) Find the eigenvalues of A and show that this system is asymptotically stable. For the parameters given [ A = ; det(si A) =s 2 +3/6s +3/4 LHP roots by inspection 3/4 3/6 (b) Suppose V (x) =x T x = x 2. If u = (input is turned off) and x(t) is the (undriven) system behavior starting from x() = x, show that dt d (V (x(t))) t= can be positive for some x. Clearly x T x = x T Px for P = I. ForV (x) =x T Px we know V (x) =x T (PA+A T P )x by a calculation done about eleven-bajillion times in class now. So here Now, A+A T = [ /4 /4 3/8 d dt (V (x(t))) t= = x T (A + A T )x ; det ( si (A + A T ) ) = s 2 +3/8 /6 λ i ( A + A T ) =/8, /2 This means (A+A T ) is not PD so we can find a non-zero vector x such that x (A + A T )x >. A perfectly good one is the eigenvector, v, corresponding to λ =/8 which is [ 8 v = So, answer is d dt (V (x(t))) t= > for x = 4 [ 8 4
9 (c) Find an initial condition, x, and a time T> so that x(t ) > x() (with the input still set to zero, of course). How can this be if the system is asymptotically stable? Explain, both mathematically and (for this physical system) physically. Let s start from the x found above in part 5b. Since the derivative of x T x is > at that point, if we make T small enough, we will have it. So you could numerically just try smaller and smaller T until you get one that works. But I ll go the long way to show you a more complete approach. OK. The solution, as we know, is x(t) =e At x and e At = L {( si A) )} = and so with x = [ 8 4 [ /4 /4 3/8 we get { x(t) = L 6s 2 +3s +2 = e 3t/32 6 and hence, starting from x = { [ = L 6s +3 6 6s 2 +3s +2 2 6s [ 28s +88 64s 96 } [ 2432 759 sin [Θ(t) + 28 cos [Θ(t) 64 cos [Θ(t)) 3264 759 sin [Θ(t) [ 8 4 we find where Θ(t) = 759t 32 } x T (t)x(t) = x(t) 2 = e 3t/6 ( 6472 sin 2 [Θ(t) + 8 ) 759 cos [Θ(t) sin [Θ(t) + 672 cos 2 [Θ(t) 759 759t where Θ(t) = 32 which I have plotted below in Figure 4. You can see that any T <. works. PLEASE NOTE! x(t) =e At x and x T (t)x(t) =x T eat t e At x but this is NOT x T e(at +A)t x! Why? Because A and A T do not generally commute. (d) Show that if P = [ 69 96 44 96 896 then for V (x) =x T Px it is true that dt d (V (x(t))) x 2. Here PA+ A T P = [ 44 44 44 and so V (x) = x 2 x 2 as was to be shown. (e) (MATLAB useful). Find a change of coordinate matrix T so that if x = T x, Ā = T TAT, c = ct, and b = T b as usual, then x(t ) < x() for all T> and for all x()
85 Norm of state starting from x = [8,4 T 8 75 x T (t)x(t) 7 65 6 55.2.4.6.8.2.4.6.8 2 Time (sec) Figure 4: x(t) 2 for Mass-Spring Damper System when M = 6, K = 2, B =3,x = [8 4 T and ẋ = Ax Can you interpret the new states, x physically? The change of coordinate is [ T = P /2.4595.263 =.263.43 I cannot interpret these new states physically. They are non-intuitive combinations of the position and velocity!