State-Space Formulation Review of analysis techniques Continuous-time domain: o Classical solution of differential equations o Impulse response and convolution o Fourier transform o Laplace transform Discrete-time domain: o Classical solution of difference equations o Impulse response and convolution o Discrete-time Fourier transform o Z-transform State-variable characterization of systems It is another time-domain analysis technique for linear systems. Advantages: o Describes all signals in system – not just inputs and outputs o Handles MIMO systems and time-varying systems readily o Ideal for computer solutions Disadvantage: o Lots of work even for setting up a simple system o Knowledge of advanced matrix mathematics required Definitions State: A summary of the past information that affects the system’s future behavior. State variables: A minimal set of variables needed to determine the future behavior of the system from the system’s inputs. State-space formulation: A mathematical description of the relationships of the input, output, and the state of the system. Continuous-time systems Differential equation: y ( n) (t ) an 1 y ( n 1) (t ) a1 y ' (t ) a0 y (t ) b0u (t ) Solving for the highest order derivative: y ( n) (t ) an 1 y ( n 1) (t ) a1 y ' (t ) a0 y (t ) b0u (t ) 1 Block diagram: u(t) + b0 y(n-1)(t) y(n)(t) y(n-2)(t) y’(t) y(t) an-1 an-2 a0 Converting an nth order differential equation to a set of n first-order differential equations: Let xi(t) represent the outputs of the integrators. As a result we can choose them as the state variables of the system. x1(t) = y(t) x2(t) = y’(t) = x1‘(t) x3(t) = y”(t) = x2‘(t) … xn(t) = y(n-1)(t) = xn-1‘(t) Rewriting these equations: x1‘(t) = x2(t) x2‘(t) = x3(t) … xn-1‘(t) = xn(t) xn‘(t) = y(n)(t) = b0 u(t) – a0 x1(t) – … – an-1xn(t) Matrix formulation: 1 0 x1 ' (t ) 0 x ' (t ) 0 0 1 2 . . . . . . . . . . . . 0 0 xn 1 ' (t ) 0 x ' (t ) a a a 1 2 n 0 . . . . . . . . 0 0 x1 (t ) 0 . 0 0 x2 (t ) 0 . . . . . . . . . . u (t ) . . . . . . 0 1 xn 1 (t ) 0 . an 2 an 1 xn (t ) b0 2 x1 (t ) x (t ) 2 y (t ) 1 0 0 0 [0] u (t ) xn 1 (t ) xn (t ) Vector notation: x’(t) = A x(t) + B u(t) y(t) = C x(t) + D u(t) where o x(t) is the state vector o y(t) is the output o u(t) is the input o A is called the state (dynamic) matrix o B is called the input matrix o C is called the output (sensor) matrix o D is called the feed through matrix Now, an nth order differential equation has been converted to a set of n first-order differential equations. For a multi-input/multi-output system: x’(t) = A x(t) + B u(t) y(t) = C x(t) + D u(t) For a system with n state variable, p inputs and q outputs: A is n n B is n p C is q n D is q p x(t) is n 1 y(t) is q 1 u(t) is p 1 The transfer function matrix: Taking the Laplace transform of the state-variable vector equation we obtain: s X(s) – x(0) = A X(s) + B U(s) X(s) = (s I – A)-1 {x(0) + B U(s)} and Y(s) = C X(s) + D U(s) 3 Y(s) = C (s I – A)-1 {x(0) + B U(s)} + D U(s) Finally, setting x(0) = 0 gives us the transfer function matrix: Y(s) = C (s I – A)-1 B U(s) + D U(s) = {C (s I – A)-1 B + D} U(s) G(s) = C (s I – A)-1 B + D or Example 1: y’’’(t) + y”(t) – 2y’(t) + 3y(t) = u(t) y’’’(t) u(t) 1 y”(t) x3(t) y’(t) x2(t) y(t) x1(t) -1 2 -3 x1 ' (t ) 0 1 0 x1 (t ) 0 x ' (t ) 0 0 1 x2 (t ) 0 u (t ) 2 x3 ' (t ) 3 2 1 x3 (t ) 1 x1 (t ) y (t ) 1 0 0 x2 (t ) 0 u (t ) x3 (t ) Example 2: Derivatives of u(t) are involved. y”(t) + 2y’(t) + 3y(t) = 4u”(t) + 5u’(t) + 6u(t) Step 1: Rearranging terms so that the derivatives are on the LHS [y”(t) – 4u”(t)] + [2y’(t) – 5u’(t)] = -3y(t) + 6u(t) Step 2: Construct the main path Input state variable x2‘(t) u(t) K x1‘(t) x2(t) 4 state variable output x1(t) y(t) Step 3: Start with the derivative terms and pass them through the first integrator x2‘(t)= [y”(t) – 4u”(t)] + [2y’(t) – 5u’(t)] x2(t) = [y’(t) – 4u’(t)] + [2y(t) – 5u(t)] Step 4: Remove the non-derivative terms x2(t) = [y’(t) – 4u’(t)] + [2y(t) – 5u(t)] x1‘(t) = y’(t) – 4u’(t) note: we will obtain this term in step 9. -[2y(t) – 5u(t)] Step 5: Pass the result through the second integrator x1‘(t)= y’(t) – 4u’(t) x1(t) = y(t) – 4u(t) Step 6: Remove the input term x1(t) = y(t) – 4u(t) y(t) note: this is the feed through term. 4u(t) Step 7: Use the input u(t) and feedback from x1(t) and x2(t) to construct x2‘(t) u(t) K x2‘(t) = -3y(t) + 6u(t) K1 x1(t) = y(t) – 4u(t) K2 x2(t) = [y’(t) – 4u’(t)] + [2y(t) – 5u(t)] Step 8: Compute the constants o K2 = 0 since x2‘(t) has no derivative term. o K1 = -3 in order to match the -3y(t) term in x2‘(t). o -3y(t) + 6u(t) = -3 [y(t) – 4u(t)] + K u(t) K = -6 5 Step 9: Use u(t) and feedback from x1(t) and x2(t)to construct x1’(t) = y’(t) – 4u’(t) u(t) K5 x2(t) = [y’(t) – 4u’(t)] + [2y(t) – 5u(t)] y’(t) – 4u’(t) K4 x1(t) = y(t) – 4u(t) K3 Step 10: Compute the constants o K4 = 1 o K3 = -2 in order to match the -2y(t) term. o - [2y(t) – 5u(t)] = -2 [y(t) – 4u(t)] + K5 u(t) K5 = -3 Step 11: Add feedback path to obtain x2‘(t) (from step 8) x2‘(t) u(t) -6 x1‘(t) x2(t) x1(t) y(t) -3 Step 12: Add feedback/through paths to obtain x1‘(t) (from step 10) -3 x2‘(t) u(t) -6 x1‘(t) x2(t) x1(t) y(t) -2 -3 Step 13: Add feed through path to obtain y(t) (from step 6) 4 -3 x2‘(t) u(t) -6 x1‘(t) x2(t) -2 -3 6 x1(t) y(t) Step 14: Formulate the state-space equations x1‘(t) = -2 x1(t) + x2(t) – 3 u(t) x2‘(t) = -3 x1(t) – 6 u(t) y(t) = x1(t) + 4 u(t) x1 ' (t ) 2 1 x1 (t ) 3 x ' (t ) 3 0 x (t ) 6 u (t ) 2 2 x (t ) y (t ) 1 0 1 4 u (t ) x2 (t ) Example 3: LRC circuit State variables: x1(t) – capacitor voltage x2(t) – inductor current Node voltage at 1: [x1(t) – u(t)] / 6 + x2(t) + x1‘(t) / 30 = 0, or x1’(t) = -5x1(t) – 30x2(t) + 5u(t) Inductor I-V equation: 5x2’(t) = x1(t) – u(t), x2’(t) = [x1(t) – u(t)] / 5 Rewriting the equations we have: x1’(t) = (-5)x1(t) + (-30)x2(t) + (5)u(t) x2’(t) = (1/5)x1(t) + (0) x2(t) + (-1/5)u(t) y(t) = (1)x1(t) + (0) x2(t) + (0) u(t) 7 or Matrix notation: x1 ' (t ) 5 30 x1 (t ) 5 u (t ) x ' (t ) 0.2 0 x2 (t ) 0.2 2 x (t ) y (t ) 1 0 1 0 u (t ) x2 (t ) Block diagram: 5 x2‘(t) u(t) -1/5 x1‘(t) x2(t) -30 -5 1/5 Example 4: (text, p. 26) Op Amp implementation: o Inverter: o Adder: 8 x1(t) = y(t) o Integrator: o Example: 2 4 2 x' x u 0 5 4 y 3 10 x 2 u Rearranging the terms we have: y 3x1 10 x 2 2u x1 ' 2 x1 4 x 2 2u x 2 ' 5 x 2 4u Constructing y: Constructing x1: 9 Constructing x2: Connecting the stages: 10 Linearization: Nonlinear systems can be linearized by ignoring the higher order terms in the Taylor series (Text P. 18). Discrete-time systems Difference equation: y(k+n) + an-1 y(k+n-1) + … + a1 y(k+1) + a0 y(k) = b0 u(k) Solving for the highest order delay: y(k+n) = -an-1 y(k+n-1) – … – a0 y(k)+ b0 u(k) Block diagram: y(k+n) u(k) b0 + z-1 y(k+n-1) -1 z y(k+n-2) y(k+1) z-1 y(k) an-1 an-2 a0 Converting an nth order difference equation to a set of n first-order difference equations: Let xi(k) represent the outputs of the unit delay. As a result we can choose them as the state variables of the system. x1(k) = y(k) x2(k) = y(k+1) = x1(k+1) x3(k) = y(k+2) = x2(k+1) … … … xn-1(k) = y(k+n-2) = xn-2(k+1) xn(k) = y(k+n-1) = xn-1(k+1) Rewriting these equations: x1(k+1) = x2(k) x2(k+1) = x3(k) … … … xn-1(k) = xn(k) xn(k) = y(k+n) = b0 u(k) – a0 x1(k) – … – an-1xn(k) 11 Matrix formulation: 1 0 x1 (k 1) 0 x (k 1) 0 0 1 2 . . . . . . . . . . . . 0 0 xn 1 (k 1) 0 x (k 1) a a a 1 2 n 0 . . . . . . . . 0 0 x1 (k ) 0 . 0 0 x2 (k ) 0 . . . . . . . . . . u (k ) . . . . . . 0 1 xn 1 (k ) 0 . an 2 an 1 xn (k ) b0 x1 (k ) x (k ) 2 y (k ) 1 0 0 0 [0] u (k ) xn 1 (k ) xn (k ) Vector notation: x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k) where o x(k) is the state vector o y(k) is the output o u(k) is the input o A is called the state (dynamic) matrix o B is called the input matrix o C is called the output (sensor) matrix o D is called the feed through matrix Now, an nth order difference equation has been converted to a set of n first-order difference equations. For a multi-input/multi-output system: x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k) For a system with n state variable, p inputs and q outputs: A is n n x(k) is n 1 B is n p y(k) is q 1 C is q n u(k) is p 1 D is q p 12 The transfer function matrix: Taking the z-transform of the state-variable vector equation we obtain: G(z) = C (z I – A)-1 B + D Example: y(k+2)+ 0.5 y(k+1) – 0.3 y(k) = 0.4 u(k) y(k+1) x2(k) y(k+2) u(k) 0.4 z-1 z-1 y(k) x1(k) -0.5 0.3 1 x1 (k ) 0 x1 (k 1) 0 x (k 1) 0.3 0.5 x (k ) 0.4 u (k ) 2 2 x (k ) y (k ) 1 0 1 0 u (k ) x2 ( k ) MIMO Example For a multi-input/multi-output system: x’(t) = A x(t) + B u(t) y(t) = C x(t) + D u(t) Example: p’’’ + 2 p’ + 3 q – 4 r’ = 5 (t) p + 8 q’ +9 q = 10 (t) – 11 (t) p’’ – 6 r’’ + 7 r = 0 Let: x1 = p x4 = q u1 = (t) x2 = p’ x5 = r u2 = (t) x3 = p’’ x6 = r’ Substituting and rearranging the equations: x3’ = -2 x2 –3 x4 + 4 x6 + 5 u1 x4’ = -(1/8) x1 – (9/8) x4 + (10/8) u1 – (11/8) u2 x6’ = (1/6) x3 + (7/6) x5 In matrix notation: 13 0 x1 ' 0 x ' 2 x3 ' 0 1 x4 ' x5 ' 8 x6 ' 0 0 1 0 0 0 0 1 0 0 2 0 3 0 0 0 9 8 0 0 0 0 0 0 1 6 0 7 6 0 0 x1 x 2 4 x 3 x 0 4 x5 1 x6 0 x1 x 2 p 1 0 0 0 0 0 0 0 q 0 0 0 1 0 0 x3 0 0 u1 x u r 0 0 0 0 1 0 4 0 0 2 x5 x6 14 0 0 5 10 8 0 0 0 0 0 u 1 11 u 2 8 0 0