EE 422G Notes: Chapter 7 Instructor: Zhang Chapter 7 State-Variable Technique 7-1 Introduction What is it about? Another method for system description and analysis. What we already have? (Why introduced Laplace Transform? to avoid the complexity of solving high-order differential equations!) Is Laplace Transform method good enough or do we need more or other techniques? (1) How effective Laplace Transform is in solving high-order differential equations with non-zero initial conditions? (2) How effective Laplace Transform is in handing multivariable (multi-input multi-output) system? (3) Classical control theory: Laplace Transform based Modern control theory: state equation based Many modern control system design methods require state equation description of system to apply! Characteristics of state-variable technique (state equation description based): (1) Uniform structure (form) for all linear-systems: despite the order, the numbers of inputs and outputs, and forms of the input functions. Always : x Ax Bu state equation y Cx Du output equation x : state vector, x = (x1, … xn)T xjs : state variable u = (u1, …, um)T : input vector ujs : inputs y = (y1,…yp)T : output vector yjs : outputs Page 7-1 EE 422G Notes: Chapter 7 Instructor: Zhang A : nxn B: nxm C: pxn D: pxm Difference: dimensions of the vectors and matrices. (2) Uniform method of solution: Laplace: different equations, different input function different solution! State: Different solution method for different inputs? No difference ! Different solution method for different systems (with different orders)? No! The same! uniform form, uniform methods for analysis and design! Fundamental Characteristic Laplace Transform, differential equation, …, convolution: external inputs external outputs! State equation (state-variable technique): External inputs internal state variables (as a bridge) external outputs help to understand the system better because of use of “internal state”! What’s the state of a system? 7-2 State-Variable Concepts (1) Example: University’s rank (simplified and idealized) What’s the fundamental measurement of university system (dynamic system)? Money? Very important, not a direct measurement of university with great inertia! What are the direct measurement which need long time to build and change? Faculty quality Student quality Good faculty => Research , Teaching Reputation , Good student Good students => student Reputation Graduate quality Good Faculty Faculty quality and student quality: Page 7-2 EE 422G Notes: Chapter 7 Instructor: Zhang State of university (dynamic system) State equations: UK’s ranking: output c1 x f c 2 x s ------- output equation (xf Faculty quality , xs: student quality) State equation: Change of faculty quality: x f a11 x f a12 xs a13 salary Change of student quality: x s b21 x f b22 xs b23 Scholorship b24 Bashetball At 2000: x f (2000), xs (2000) : initial state At and after 2000: (state appreciation, private donations) => (salary, scholarship) Administration, basketball: future inputs => UK’s ranking (determined by initial state and future inputs) (2) State, state-variables, state-space, trajectory: State of a system at t 0 : includes the minimum information necessary to specify completely the condition of the system at t0 and allow determination of all system outputs at t>t0 when inputs up to time t are specified. State : a set of state variables State: x x f xs (state vector) State Space: x f x Set of all possible x (All possible paired values s ( x f (1), x s (1)); ( x f (2), x s (2));...) ) Trajectory of the state x (2000) x f x s (2000) x (2001) x f x s (2001) …… Page 7-3 EE 422G Notes: Chapter 7 Instructor: Zhang a curve in two-dimensional space. x1 x x n In general 7-3 Form of the state equations 1. Form Example : x1 a11 x1 a12 x 2 b11u1 b12u 2 x 2 a 21 x1 a 22 x 2 b21u1 b22 u 2 x Ax Bu y1 c11 x1 c12 x2 d11u1 d12 u 2 y2 c21 x1 c22 x2 d 21u1 d 22 u 2 y Cx Du x x 1 , x2 a A 11 a21 a12 , a22 b B 11 b21 b12 b22 y y 1, y2 c C 11 c21 c12 , c22 d D 11 d 21 d12 d 22 u u 1 u 2 Page 7-4 EE 422G Notes: Chapter 7 Instructor: Zhang In general : x1 x , x n x Ax Bu y cx du A:nn C : pn ( x : n 1 , u1 u , u m y1 y , yp state equation output equation B :nm D:cm u : m 1 , y : p 1 ) (2) Simulation example x1 a11 x1 a12 x2 b11u1 b12 u2 x2 a21 x1 a22 x2 b21u1 b22 u2 y c1 x1 c2 x2 d1u1 d 2u2 Page 7-5 EE 422G Notes: Chapter 7 Instructor: Zhang (3) Block Diagram of state equation x Ax Bu y cx du Homework 1. Given x (t ) Ax (t ) Bu (t ) with initial condition x(t0 ) x0 where x0 is the given initial state. Construct an algorithm (recursive equation) to calculate x(t0 (k 1)t ), (k 0,1,...) based on x(t0 kt ) and u(t0 kt ) where t 0 is a small time interval. 2. Given the initial condition problem x Ax Bu x(t0 ) x0 It is known that the solution of this problem is unique. Prove that the unique solution of this problem is x(t ) e A( t t 0 ) t x0 e A(t ) Bu ( )d t0 d f ( , t ) f ( , t )d f ( , t ) t d ) (Note: dt a t a t t 3. Use Laplace transform to prove Y (s) [c(sI A) 1 B D]U (s) x (t ) Ax(t ) Bu (t ), when y (t ) Cx(t ) Du (t ) x(0) 0 Page 7-6 EE 422G Notes: Chapter 7 Instructor: Zhang 7-4 Time-Domain solution of the state equations Focus: Find x(t) (t t0) which satisfies x Ax Bu x(t0 ) x0 x0 given 1. Mathematical Preparation (1) Matrix Exponential eAt Scalar Exponential e at 1 at a2 2 a3 3 t t 2! 3! Introducing Notation e At I At where : 1 2 2 1 33 A t A t 2! 3! A : n n matrix 0 1 n I : n n Identity matrix 0 1 2 A : AA n n Aj : nn n n n n j = 0,1,2,… t: scalar e At : n n Properties of eAt de At Ae At dt e At I At 1 2 2 1 33 A t A t 2! 3! Page 7-7 EE 422G Notes: Chapter 7 Instructor: Zhang de At 2 3 0 A A 2 t A 3t 2 dt 2! 3! 1 A( I At A2t 2 ) 2! Ae At e A0 I 1 2 2 A 0 I 2! * (Inverse of n n matrix eAt is e-At) (e At ) 1 e At 1 1 I ( A)t ( A) 2 t 2 ( A)3 t 3 2! 3! 1 1 I At A2t 2 A3t 3 2! 3! 1 1 I A(t ) A2 (t ) 2 A3 (t )3 2! 3! t f ( , t ) f ( , t )d f ( , t ) t d ) t a e A0 I A 0 d t (2) dt a A( t ) Bu ( ) If f ( , t ) e t d t f ( , t ) f ( , t ) d f ( , t ) Then t d t dt t t 0 But 0 f (, t ) t e A(t t ) Bu (t ) IBu (t ) Bu (t ) , f ( , t ) Ae A(t ) Bu ( ) t t t d A( t ) Bu ( )d Bu (t ) A e A(t ) Bu ( )d Therefore dt e t0 t0 Page 7-8 EE 422G Notes: Chapter 7 Instructor: Zhang t Z (t ) e A(t ) Bu ( )d Denote t0 => t d Z (t ) e A(t ) Bu ( )d dt t 0 AZ (t ) Bu (t ) Z (t ) AZ (t ) Bu (t ) i. e. 2. Numerical solution of state equations (Eq. (7-9)----Eq. (7-15)) 3. Analytic solution of homogeneous equaiton x Ax x(t 0 ) x0 zero-input response question : what do we mean that x(t) = f(t) is a solution of a differential equation with a given initial condition ? (1) x df (t ) =Af(t) dt (2) f (t ) t 0 x0 for example, if we assume x(t)=At then x A A( At ) Ax (t ) x(t)=At is not a solution of x (t ) Ax (t ) x Ax question : Is x(t ) e x0 a solution of ? x(t 0 ) x0 At x (t ) d At (e x0 ) Ae At x0 Ax (t ) dt Page 7-9 EE 422G Notes: Chapter 7 => x Ax Instructor: Zhang x Ax satisfies the first of x(t 0 ) x0 However, x(t0 ) e At 0 x0 If t0 0 and A 0 , e At0 I => x(t0 ) x0 Therefore, x Ax x(t 0 ) x0 x(t ) e At x0 is not a solution of x Ax Question: If we find a solution for x(t 0 ) x0 Can we find a second different solution for it? x Ax No! The solution for is unique x(t 0 ) x0 when A = constant matrix! x Ax Let’s find “any” solution for . It will be the unique solution! x(t 0 ) x0 Suggested solution x(t ) e A(t t 0 ) x0 verification: de A(t t 0 ) x0 (1) x Ae A(t t 0 ) x0 Ax dt A(t t ) (2) x(t0 ) e 0 0 x0 Ix0 x0 => x(t ) e A(t t 0 ) x0 : unique solution Page 7-10 EE 422G Notes: Chapter 7 4. Analytic solution of Instructor: Zhang x Ax Bu x(t 0 ) 0 (a) (b) . (zero-state response) t Suggested solution : x(t ) e A(t ) Bu ( )d t0 Verification: From mathematical preparation: t z (t ) e A(t ) Bu ( ) d our suggested x(t) t0 => z (t ) Az (t ) Bu (t ) Hence, suggested solution x(t) satisfies x (t ) Ax (t ) Bu (t ) (a) t0 Further, x(t0 ) e A(t 0 ) Bu ( )d 0 (b) t0 x Ax Bu 5. Solution of x(t ) x 0 0 (Given problem) Solution: zero-input response + zero-state response x(t ) e A( t t 0 ) t x0 e A(t ) Bu ( )d t0 6. State Transition Matrix (t ) e At No input, x(t) is a transition of x0 at t0 to t>t0: x(t ) e A(t t 0 ) x0 (t t0 ) x0 7. Output t y (t ) C (t t0 ) x0 C (t ) Bu ( )d Du (t ) t0 Page 7-11 EE 422G Notes: Chapter 7 Instructor: Zhang 7-5 Frequency-Domain solution of the State Equation x(0) x0 x Ax Bu , (t0 0) 1. Solution sX ( s ) x0 AX ( s ) BU ( s ) ( sI A) X ( s ) x0 BU ( s ) X ( s ) ( sI A) 1 x0 ( sI A) 1 BU ( s ) x(t ) L1 [( sI A) 1 x0 ] L1 [( sI A) 1 BU ( s )] 2. What is (sI A) 1 ? L1[(sI A) 1 ] e At (t ) (sI A) 1 : Laplace transform of the state transition matrix or of eAt. Denote: (s) (sI A) 1 What is (sI A) 1 BU (s) ? ( s )(BU ( s)) ---- product of (s ) and BU (s ) ! L1[(sI A) 1 BU (s)] : convolution of L1[( sI A) 1 ] (t ) and L1[ BU (s)] Bu (t ) ! Hence t L [( sI A) BU ( s)] (t ) * Bu (t ) (t ) Bu ( )d 1 1 0 3. Output Laplace Transform and Transfer Function Matrix Y ( s) CX ( s) DU ( s) C ( sI A) 1 x0 c( sI A) 1 BU ( s) DU ( s) When x0 0 Y ( s) C ( sI A) 1 BU ( s) DU ( s) [C ( sI A) 1 B D]U ( s) Page 7-12 EE 422G Notes: Chapter 7 Instructor: Zhang ( p m) Denote H (s) C ( sI A) 1 B D => Y ( s ) H ( s )U ( s ) H(s): Transfer function matrix H11 ( s) H12 ( s) H1m ( s) H (s) H p1 ( s) H p 2 ( s) H pm ( s) Hij(s) : transfer function between the jth input and ith output. 4. Impulse Response Matrix H(t) H (t ) L1 [ H ( s)] H (t ) L1 [C ( sI A) 1 B D] Ce At B D (t ) (t ) is m 1 vector impulse 5. Is that all for state equation technique? No! We have not found effective way for eAt yet! 7-6 Finding the state Transition Matrix 1. Based on Definition (t ) e At I At (Note: 1 2 2 1 33 A t A t 2! 3! 1 k A must go to 0nn as k ; otherwise, eAt does not exist) k! Why numerical calculation possible? Convergence of 1 k A k! Example 7-1 Easy example Example 7-2 Not easy example. I can not do it! 2. Based on (s) (sI A) 1 (t ) L1[(sI A) 1 ] Page 7-13 EE 422G Notes: Chapter 7 Instructor: Zhang Key : (1) Find (sI A) 1 ; (2) For each element of (sI A) 1 , obtain partial-fraction expansion 1 0 6 5 Example 7-3 A 1 s 1 s 0 0 ( sI A) 0 s 6 5 6 s 5 a11 a 21 a12 a22 1 a22 a12 a a11 21 a11 a22 a12 a21 s 5 1 6 s s 1 1 ( sI A) s ( s 5) 6 6 s 5 s 5 1 s5 6 s ( s 2)( s 3) 6 ( s 2)( s 3) ( s 2)( s 3) 1 1 ( s 2)( s 3) s ( s 2)( s 3) s5 3 2 3e 2t 2e 3t ( s 2)(s 3) s 2 s 3 1 1 1 e 2t e 3t ( s 2)(s 3) s 2 s 3 6 1 1 6 6[e 2t e 3t ] ( s 2)(s 3) s 2 s 3 s 2 3 2e 2t 3e 3t ( s 2)(s 3) s 2 s 3 eAt = … (sI-A)-1 : Systematic way exists! But very complex operation! Page 7-14 EE 422G Notes: Chapter 7 Instructor: Zhang 3. Diagonalization A nn A PP P : nn : nn 1 t diagonal e : easy to matrix find A k ( PP 1 )( PP 1 ) ( PP 1 ) Pk P 1 A2 2 t 2! 1 PP 1 PP 1t P2 P 1t 2 2! 1 P[ I t 2 t 2 ]P 1 2! t 1 Pe P e At I t 4. Cayley – Hamilton Theorem Based Method (t ) e At 0 (t ) I 1 (t ) A 2 (t ) A2 n 1 (t ) An 1 nXn This method will be simple if the eigenvalues of A( j ) are distinct: Replacing A by j and I by 1 in the above equation. Replacing by 1 : e 1t 0 (t ) 1 (t )1 2 (t )1 n 1 (t )1 …… n 1 2 t n 1 Replacing by n : e n 0 (t ) 1 (t )n 2 (t )n n 1 (t )n (mention (1) 0 (t ),1 (t ), 2 (t ) … …are the same in each of the n equations.) (2) j ' s are given numbers! ) 2 Example 7-4 The same A in examples 7-2, 7-3. 1 0 A 6 5 (1) Find eigenvalues : easy by using Matlab Page 7-15 EE 422G Notes: Chapter 7 Instructor: Zhang a = [0 1 ; -6 –5]; eiga = eig(a); eiga eiga = -2 -3 Analytic Method: | I A | 1 6 5 1 2, ( 5) 6 2 5 6 0 2 3, (2) 1 2 e 2t 0 (t ) 1 (t )(2) (1) 2 3 e 3t 0 (t ) 1 (t )(3) (2) (1) (2) e 2t e 3t 1 (t ) 0 (t ) e 3t 31 (t ) e 3t 3e 2t 3e 3t 3e 2t 2e 3t Page 7-16 EE 422G Notes: Chapter 7 Instructor: Zhang (3) e At 0 (t ) I 1 (t ) A 3e 2t 2e 3t 0 0 0 3e 2t 2e 3t 6e 2t 6e 3t 3e 2t 2e 3t e 2 t e 3t 2t 3t 2e 2t 3e 3t 6e 6e e 2 t e 3t 5e 2t 5e 3t The same as obtained in Example 7-2 and 7-3. Question: What about some repeated eigenvalues? Method can be modified! EE611 7-7 State Equation of Electrical Networks Obtain State Equations for Systems Two examples: From electrical networks From transfer functions (system realization) For electrical network: select iL and vC as state variables. Algorithm Step 1: Select each iL and vc as state variables diL Step 2: For each iL , write a KVL ( iL will be included) dt For each vc , write a KCL ( vC will be included) Step 3: Other KCL and KVL, and element relation to eliminate “other” variables (other than states (iL, vc ) and sources (input). =>state equation. Step 4 : Output equation Page 7-17 EE 422G Notes: Chapter 7 Instructor: Zhang Example 7-7 Step 1: Label vc as x1 iL as x2 Step 2: For vc , write KCL : iR1 Cx1 x2 (1) For iL , write KVL x1 Lx2 iR2 R2 (2) Step 3 : Other variables (undesired): iR1 , iR2 iR1 v x1 s R1 Must be expressed in terms of state variables and sources! i R 2 i L x2 vs x1 Cx1 x2 (1)' R1 x Lx R x 1 2 2 2 1 1 1 x x x vs 1 2 1 CR1 C CR1 x 1 x R2 x 2 L 1 L 2 1 1 x1 1 x1 CR1 C CR1 vs R x x2 1 2 2 0 L L Step 4 : Output equation y = v0 Page 7-18 EE 422G Notes: Chapter 7 Instructor: Zhang x y R2 x2 0 1 1 x2 7-8 State Equation from Transfer Functions State Equation => Tell how to realize and simulate (system realization) the systems Problem in this section : Y ( s) bm s m bm 1s m 1 b1s b0 n Given U (s) s an 1s n 1 a1s a0 Find x Ax Bu y Cx Du ( m n) (u --- scalar, y --- scalar) 1 Such that C ( sI A) B D equals the given transfer function. 1. Basic solution Example : Y ( s) 4 4 4 4U (S ) 4U (s) Y ( s) 4 X 1 ( s) 4 X 2 ( s) U (s) (s 1)( s 2) s 1 s 2 s 1 s 2 U ( s) x1 x1 u s 1 U (s) X 2 ( s) x2 2 x2 u s2 x1 1 0 x1 1 x 0 2 x 1u 2 2 X 1 (s) x y 4 4 1 x2 General Case Y ( s) bm s m bm 1s m 1 b1s b0 U ( s) ( s p1 )(s p2 ) ( s pn ) Page 7-19 EE 422G Notes: Chapter 7 Instructor: Zhang Assumption: No repeated poles No zero-pole cancellation Partial-Fraction Expansion: Bn B1 B2 Y (s) U ( s ) s p1 s p 2 s pn Y (s) B U (s) B1U ( s ) B2U ( s ) n s p1 s p2 s pn B1 X 1 ( s ) B2 X 2 ( s ) Bn X n ( s ) x1 x y (t ) B1 , B2 , Bn 2 ---- output equation xn ( U ( s) x j p j x j u(t ) ) s pj 0 x1 1 u (t ) ---- state equation pn xn 1 X j ( s) x1 p1 x n 0 Drawback (not serious): Complex pole Complex coefficients! There are ways to fix it! 2. Repeated pole : No zero-pole cancellation Y ( s) A B U ( s) ( s pi ) 2 s pi Denote: Yi ( s ) AU ( s ) BU ( s ) AX i1 ( s ) BX i2 ( s ) ( s pi ) 2 s pi Page 7-20 EE 422G Notes: Chapter 7 Instructor: Zhang X i2 ( s ) U ( s) s pi x i2 pi xi2 u (t ) X i1 ( s) X i2 ( s ) s pi x i1 pi xi1 xi2 ( s) Sub-block : xi1 pi x i2 0 1 xi1 0 u pi xi2 1 xi yi A B 1 xi2 How to incorporate this method into system realization, see examples. Example 7-9 Y (s) s 2 3s 9 U ( s ) 5s 5 8s 4 24 s 3 34 s 2 23s 6 3.5 4.75 5.875 7 1.125 Y (s) 3 2 s 1 s 2 s 3 ( s 1) ( s 1) 0 0 0 x1 0 x1 1 1 x 0 1 1 0 0 x 2 0 2 x3 0 0 1 0 0 x3 1u (t ) x 0 0 0 2 0 4 x4 1 x5 0 0 0 0 3 x5 1 Page 7-21 EE 422G Notes: Chapter 7 Instructor: Zhang x1 x 2 y (t ) 3.5 4.75 5.875 7 1.125 x3 x4 x5 (3) Matlab Use From state-equation => Transfer Function [num, den] = ss2tf [A, B, C, D] to From transfer Function => state-equation [A, B, C, D] = tf2ss [num, den] Page 7-22