ASSIGNMENT I: LINEAR SYSTEMS COSMIN IONIŢĂ∗ In this first project, we cover basic systems theory. We begin with a dynamical system from Electrical Engineering. The circuit presented is composed of resistors (the R’s), inductors (the L’s), capacitors (the C’s), and a voltage source v(t) that feeds voltage to the circuit. In literature, it is often called a RLC circuit. First, we want to write down the state-space equations. The following laws describe the system dynamics: (i) the current through a capacitor is proportional to the derivative of the voltage accross the capacitor, and (ii) the voltage accross an inductor is proportional to the derivative of the current through the inductor, i.e., d (i) iC (t) = C dt uC (t), d (ii) uL (t) = L dt iL (t). We can substitute these formulas into Kirchhoff’s current and voltage laws: (i) the sum of the currents entering a node equals the sum of the currents exiting the node, and (ii) the sum of the voltages across a closed loop equals zero, e.g., (i) iR (t) = iC1 (t) + iL1 (t), (ii) v(t) = uR (t) + vC1 (t) = R iR (t) + vC1 (t). a) Let the input u(t) equal the voltage v(t), and let the states be defined as: x1 (t) vC1 (t) x2 (t) vC2 (t) x(t) = x3 (t) = iL1 (t) . iL1 (t) x4 (t) Also, lets observe two outputs, namely x2 (t) and x4 (t): x2 (t) y(t) = . x4 (t) ∗ Department of Electrical and Computer Engineering, Rice University, 6100 Main Street—MS 366, Houston, Texas 77005–1892 (cosmin.ionita@rice.edu). 1 2 COSMIN IONIŢĂ Write down the system matrices [E, A, B, C, D]. Hint: You may want to use Kirchhoff’s laws again, to get formulas for x˙2 and x˙3 . Answer: C1 0 E= 0 0 0 C2 0 0 1 R 0 0 L1 0 0 B= 0 0 0 0 0 L2 C= 0 0 0 −1 0 − R1 0 0 1 −1 A= 1 −1 0 0 0 1 0 0 1 0 0 0 0 1 D= 0 0 . Let R = 1, C1 = C2 = 1 and L1 = L2 = 1. b) Check if the system is stable. Produce a plot of the system poles. c) Consider the input u(t) = δ(t) ,i.e., we apply a unit impulse (Dirac delta function) to the system. In this case, y(t) is called the impulse response of the system. Derive a formula for y(t). Next, assume zero initial conditions. Plot the four state trajectories x1 (t), x2 (t), x3 (t) and x4 (t) on the same graph. Comment on what you observe for t → ∞. d) Take the following input signal: t ∈ [0, 5], t, 5, t ∈ [5, 10], u(t) = 0, otherwise We would like to understand what happens with the state trajectories. Altough, in this example, a formula for y(t) is within reach, we wish to avoid computing integrals. One quick way of plotting the state trajectories is by using MATLAB’s Control System Toolbox. Use the lsim function to compute x(t) for t = [0, 100]. Plot the state trajectories. Hint: lsim takes as input argument a system declared as a state-space model ss. You can declare your system as: sys = ss(A,B,C,D). Answer: Assignment I: Linear Systems 3 clear all, close all A = B = C = D = sys [-1 0 -1 0;0 0 1 -1;1 -1 0 0;0 1 0 0]; [1 0 0 0]’; [0 1 0 0; 0 0 0 1]; [0 0]’; = ss(A,B,C,D); t = [0:.1:100]; u = [0:.1:5,5*ones(1,50),zeros(1,900)]; figure,clf plot(t,u,’k’) title(’u(t)’) xlabel(’t’) [y,t,x] = lsim(sys,u,t); figure,clf plot(t,x) title(’x(t)’) xlabel(’t’) e) Plot the amplitude of the transfer function H(jω) = C(jωI − A)−1 B + D. Comment on the position of the peaks relative to the ω axis. Hint: You can build your own function to compute the amplitude, or you may want to try bode, sigma or freqresp in MATLAB. Answer: clear all, close all A B C D = = = = [-1 0 -1 0;0 0 1 -1;1 -1 0 0;0 1 0 0]; [1 0 0 0]’; [0 1 0 0; 0 0 0 1]; [0 0]’; figure,clf sigma(ss(A,B,C(1,:),D(1,:)),’r’) hold on sigma(ss(A,B,C(2,:),D(2,:)),’b’) legend(’From input 1 to output 1’,... ’From input 1 to output 2’, ’Location’,’SouthWest’) f ) Show that this system is both controllable and observable. g) Is it possible to transfer the system from state x̂ = e1 , at t = 0, to x̃ = e4 , where ei is the ith unit vector? 4 COSMIN IONIŢĂ Answer: Is there an input u(t) s.t.: x̃ = e AT x̂ + Z T eA(T −τ ) Bu(τ )dτ ? 0 Let z = x̃ − eAT x̂ = Z T eA(T −τ ) Bu(τ )dτ. 0 We need to show that the state z is controllable from the zero state at time zero i.e. z ∈ X contr . x̂ ∈ X contr eAt x̂ ∈ A X contr ⊂ X contr Therefore, z = x̃ − eAT x̂ is in the controllable subspace. Any states in the controllable subspace can be joined by a state trajectory for an appropriate input. h) Show that controllability is basis independent. That is, for a nonsingular matrix T that transforms the state basis x̂ = T x, show that the system has the same degree of controllability as before. Is the transfer function H(s) affected by the state basis change ? Answer: Â = T AT −1 B̂ = T B C(Â, B̂) = T B, T AB, . . . , T An−1 B = T B, AB, . . . , An−1 B = T C(A, B). T is full rank, therefore, the controllability matrices have the same ranks. i) Give an example of a vector B such that the system is not controllable. Answer: The controllability matrix C(A, B) = B, AB, . . . , An−1 B is rank defficient. Then, there exists a vector w such that w∗ C(A, B) = 0 w∗ I, A, . . . , An−1 B = 0. Assignment I: Linear Systems 5 Suppose (λ, w) is an eigenpair of A∗ : h i n−1 w∗ I, A, . . . , An−1 B = 1, λ, . . . , λ w∗ B = 0. Thus, B has to be orthogonal to an eigenvector of A∗ . j) Let R = 3/5, C1 = C2 = 1 and L1 = L2 = 1. Take a new matrix 1 0 0 0 C= 0 1 0 1 for the previous system. Determine observability from y and, then, just from y2 , i.e., C = C(2, :). For the unobservable systems, determine if any of the states e1 , e2 , e3 or e4 can be observed by looking at the respective output. Answer: X unobs = ker(O(C(2, :), A)) O(C(2, :), A) = 0 0 1 − 32 1 0 1 1 1 −1 −2 1 −1 −2 −3 2 We can observe e1 , e2 , e3 and e4 . k) For the systems you found to be unobservable at point i), determine a basis for the unobservable subspace. Answer: −3α −α ker(O(C(2, :), A)) = 2α α for any complex number α.