Discrete-Time State-Space Equations M. Sami Fadali Professor of Electrical Engineering UNR 1
Outline Discrete-time (DT) state equation from solution of continuous-time state equation. Expressions in terms of constituent matrices. Solution of DT state equation. Example. 2
Solution of State Equation x t f = e A t f t 0 x t 0 t f + න e A t f τ Bu τ dτ t 0 Obtain difference equation from the solution of the analog state, over a sampling period T. Initial time t 0 = kt, and final time t f = k + 1 T k+1 T x k + 1 = e AT x k + න kt e A k+1 T τ Bu τ dτ x k = x kt = state vector at time kt 3
Digital Control Piecewise constant inputs over a sampling period. u t = u k, Move input outside the integral x k + 1 = e AT x k + න kt k+1 T kt t k + 1 T e A k+1 T τ Bdτ u k 4
Simplify Integral Change of variable of integration λ = k + 1 T τ, λ = ቊ 0, τ = k + 1 T T, τ = kt dλ = dτ න kt k+1 T e A k+1 T τ Bdτ = න 0 T T = න 0 e Aλ B dλ e Aλ Bdλ 5
Discrete State-Space Equations x k + 1 = A d x k + B d u k, k = 0,1, T A d = e AT, B d = න e Aτ Bdτ 0 y k = Cx k + Du k Obtain A d using state-transition matrix of A Integrate to obtain B d 6
State & Input Matrices A d = n n discrete state matrix B d = n m discrete input matrix (same orders as their continuous counterparts). Discrete state matrix = state transition matrix of the analog system evaluated at the sampling period T. Properties of the matrix exponential: integral of the matrix exponential for invertible matrix A e At dt = A 1 e At = e At A 1 B d = A 1 e AT I n B = e AT I n A 1 B 7
Constituent Matrices Use expansion of the matrix exponential in terms of the constituent matrices. Eigenvalues of discrete state matrix related to those of the analog system. n n A d = Z i e λ it = Z i e λ it i=1 t=t i=1 8
Input Matrix T T B d = න e Aτ Bdτ = න 0 0 n B d = i=1 n Z i e λ iτ i=1 T Z i B න e λiτ dτ 0 Bdτ Scalar integrands: easily evaluate integral. B d = n i=1 Z i B 1 eλ it λ i, λ i 0 n Z 1 BT + i=2 Z i B 1 eλ it λ i, λ 1 = 0 Assume distinct eigenvalues (only one zero eigenvalue) 9
Discrete-time State-space Representation Discrete state & output equation. Discrete-time state equation: approximately valid for a general input vector u t provided that the sampling period T is sufficiently short. x k + 1 = A d x k + B d u k Output equation evaluated at time kt y k = Cx k + Du k 10
ሶ Example 7.15 Obtain the DT state equations for the system of Example 7.7 x 1 0 1 0 x 1 0 x2 ሶ = 0 0 1 x 2 + 0 u xሶ 3 0 10 11 x 3 10 for a sampling period T=0.01 s. Solution: From Example 7.7, the state-transition matrix is e At = 10 11 1 0 0 0 0 0 0 e 0 0 10 1 10 + 0 10 1 0 10 1 e t 0 1 1 9 + 0 10 10 0 100 100 e 10t 90 11
Discrete state matrix A d = e A 0.01 10 11 1 e 0 0 10 1 = 0 0 0 10 + e 0.01 0 10 1 9 0 0 0 0 10 1 0 1 1 e 10 0.01 + 0 10 10 90 0 100 100 Simplifies to 1.0 0.1 0.0 A d = 0 0.9995 0.0095 0 0.0947 0.8954 12
Discrete-time Input matrix B d = Z 1 B 0.01 + Z 2 B 1 e 0.01 + Z 3 B 1 e 10 0.01 10 = 0.01 0 0 + 10 9 1 1 1 1 e 0.01 + 1 9 1 10 100 1 e 10 0.01 10 Simplifies to B d = 1.622 10 6 4.821 10 4 9.468 10 2 13
MATLAB Obtain A d, B d, C, D from A, B, C, D» A=[1,2;3,4]; B=[0;1];C=[1,1]; D=0;» p=ss(a, B, C, D); % State-space matrices» pd = c2d(p,0.01) % piecewise constant input (default) Alternatively, use the MATLAB commands» ad = expm(a * 0.05)» bd = a\ (ad-eye(3) )* b 14
a = MATLAB Output x1 x2 x1 1.01 0.02051 x2 0.03076 1.041 b = u1 x1 0.0001017 x2 0.0102 c = x1 x2 y1 1 1 d = u1 y1 0 Sampling time: 0.01 Discrete-time model. 15
Solution of DT State-Space Equation DT State Equation: state at time k in terms of the initial condition vector x 0 and the input sequence u k, k = 0, 1,, k 1. x k + 1 = A d x k + B d u k At k = 0, 1, we have x 1 = A d x 0 + B d u 0 x 2 = A d x 1 + B d u 1 = A d 2 x 0 + A d B d u 0 + B d u 1 16
Solution by Induction 2 1 x 2 = A 2 d x 0 + A 2 i 1 d B d u i i=0 k 1 x k = A k d x 0 + A k i 1 d B d u i i=0 k 1 k k x k = A 0 d x k 0 + A k i 1 d B d u i Solution i=k 0 =zero-input response+ zero-state response 17
State-transition Matrix State-transition matrix for the DT system A d k. State-transition matrix for time-varying DT system: not a matrix power dependent on both time k and initial time k 0 18
Output Solution Substitute in output equation y k = Cx k + Du k k 1 = C A k d x 0 + A k i 1 d B d u i i=0 + Du k 19
Z-Transform Solution of DT State Equation z-transform the discrete-time state equation zx z zx 0 = A d X z + B d U z X z = zi n A 1 d zx 0 + B d U z zi n A 1 d z = I n 1 z A d = I n + A d z 1 + A 2 d z 2 + + A i d z i + 1 20
Inverse z-transform Inverse z-transform zi n A d 1 z zi n A d 1 z = I n + A d z 1 + + A d i z i + Z 1 zi n A d 1 z = I n, A d, A d 2,, A d i, = A d k k=0 Analogous to the scalar transform pair z z a d Z a d k k=0 21
Matrix Inversion Evaluate using the Leverrier algorithm. Partial fraction expansion then multiply by z. zi A d 1 z = z adj zi A d det zi A d = P 0z + P 1 z 2 + + P n 1 z n a 0 + a 1 z + + a n 1 z n 1 + z n n = i=1 z z λ i Z i, n A k k d = Z i λ i i=1 22
DT State Matrix n A d = i=1 n Z i λ i = i=1 Z i A e λ i A T Parentheses: pertaining to the CT state matrix A. Equality for any sampling period T and any matrix A Z i = Z i A λ i = e λ i A T Same constituent matrices for DT state matrix & CT state matrix A DT eigenvalues are exponential functions of the CT eigenvalues times the sampling period. 23
Zero-state Response x ZS t = zi n A d 1 z z 1 B d U z Known inverse transform for. term. Multiplication by z 1 : delay by T. Convolution theorem: inverse of product is the convolution summation k 1 x zs k = A k i 1 d B d u i, A k d = Z j e λ j A kt i=0 j=1 k 1 n x zs k = Z j e λ j A k i 1 T B d u i i=0 j=1 n 24
Alternative Expression k 1 n x zs k = Z j e λ j A k i 1 T B d u i i=0 j=1 Change the order of summation n x zs k = j=1 k 1 Z j B d e λ j A k 1 T i=0 u i e λ j A it Useful when the i summation has a closed form. 25
Step Inputs n k 1 x zs k = Z j B d e λ j A k 1 T u i e λ j A it j=1 i=0 u k = 1 = 1 1 T k 1 a i = 1 ak 1 a, a 1 i=1 n x zs k = j=1 Z j B d 1e λ j A k 1 T 1 e λ j A kt 1 e λ j A T 26
ሶ Example 7.16 x = 0 1 2 3 x + 0 1 u (a) Solve the state equation for a unit step input and the initial condition vector x 0 = 1 0 T (b) Use the solution to obtain the discrete-time state equations for a sampling period of 0.1s. (c) Solve the discrete-time state equations with the same initial conditions and input as in (a) and verify that the solution is the same as that of (a) evaluated at multiples of the sampling period T. 27
Solution (a)the resolvent matrix s + 3 1 Φ s = s 1 1 2 s = 2 s + 3 s 2 + 3s + 2 1 0 0 1 s + 3 1 2 0 = s + 1 s + 2 Partial fraction expansions 3 1 2 0 1 0 0 1 1 s + 1 s + 2 = 3 1 2 0 s s + 1 s + 2 = 1 0 0 1 1 s + 1 + 1 s + 2 1 s + 1 + 2 s + 2 28
State-transition Matrix 1 0 0 1 s + 3 1 2 0 Φ s = s + 1 s + 2 1 0 0 1 + 3 1 2 0 = s + 1 + 2 1 1 1 = 2 1 2 2 + s + 1 s + 2 φ t = 2 1 2 1 e t + 2 1 0 0 1 3 1 2 0 s + 2 1 1 2 2 e 2t 29
Zero-input Response x ZI t = e At x 0 = 2 1 2 1 e t + = 2 2 e t + 1 2 e 2t 1 1 2 2 e 2t 1 0 30
Zero-state Response x ZS t = 2 1 2 1 e t + 1 1 2 2 e 2t 0 1 1 t = 1 1 e t 1 t + 1 2 e 2t 1 t x ZS t = = 1/2 0 1 1 (1 e t ) + 1 2 (1 e 2t )/2 1 1 e t 1/2 1 e 2t 31
Total Response x t = x ZI t + x ZS t x t = 2 2 e t + 1 2 e 2t + 1/2 0 = 1/2 0 1 1 e t 1/2 1 + 1 1 e t + 1/2 1 At the sampling points: e 2t e 2t t = multiples of 0.1s 32
(b) Discrete-time state equations A d = φ 0.1 = 2 1 1 1 2 1 e 0.1 + 2 2 e 0.2 = 0.9909 0.0861 0.1722 0.7326 B d = 2 1 2 1 1 1 1 1 e 0.2 0 e 0.1 + 2 2 2 1 = 1/2 0 e 0.2 1 1 e 0.1 1 2 2 = 0.0045 0.0861 x 1 = A d x 0 + B d u 0 CT system response to a step input of duration one sampling period=response of CT system due to a piecewise constant input over one period 33
Zero-input Response A d k = Φ 0.1k = 2 1 2 1 e 0.1k + = 2 1 2 1 e 0.1k + x ZI k = 1 1 2 2 e 0.2k x ZI k = Φ 0.1k x 0 1 1 1 2 2 e 0.2k 0 2 2 e 0.1k + 1 2 e 0.2k Same as the zero-input response of the continuous-time system x ZI t = 2 2 e t + 1 2 e 2t at all sampling points k = 0, 1, 2, 34
z-transform of the zero-state Φ z = 2 1 2 1 X ZS z = Φ z z 1 B d U z response z 1 + 1 z e 0.1 2 2 z z e 0.2 = 2 1 z 1 2 1 z e 0.1 + 1 2 2 = 9.5163 10 2 1 1 +9.0635 10 2 1 2 z 0.0045 z e 0.2 0.861 z z e 0.1 z 1 z z e 0.2 z 1 z 1 z z 1 35
Partial Fractions z z e 0.1 z 1 = 1 z 1 e 0.1 z 1 + 1 z z e 0.1 = 10.5083 z z 1 + 1 z z 0.9048 z z e 0.2 z 1 = 1 z 1 e 0.2 z 1 + 1 z z e 0.1 = 5.5167 z z 1 + 1 z z 0.8187 36
Expand zero-state response X ZS z 1 z = 2 z 1 0 x ZS k = 1/2 0 1 1 z z e 0.1 1 2 1 1 1 e 0.1k 1/2 1 z z e 0.2 e 0.2k Same as zero-state response for the CT system x ZS t = 1/2 1 0 1 e t 1/2 e 2t 1 at time t = 0.1 k, k = 0,1,2, 37
Zero-state response k 1 n x zs k = Z j e λ j A k i 1 T B d u i i=0 j=1 n k 1 x zs k = Z j B d e λ j A k 1 T u i e λ j A it j=1 i=0 k 1 u k = 1 = 1 1 T, a i = 1 ak 1 a, a 1 n x zs k = j=1 i=1 Z j B d 1e λ j A k 1 T 1 eλ j A kt 1 e λ j A T 38
z-transfer Function x k + 1 = A d x k + B d u k y k = Cx k + Du k Y z = CX s + DU z For zero initial conditions zx z = A d X z + B d U z X z = zi n A d 1 B d U z Substitute Y z = C zi n A d 1 B d U z + DU z = C zi n A d 1 B d + D U z = G z U z 39
Impulse Response & Modes G z = C zi n A d 1 B d + D Inverse transform of the transfer function G z = C zi n A d 1 B d + D Z G k = ቊ CA d k 1 B d, k 1 D, k = 0 Substitute in terms of constituent matrices n G z = i=1 CZ i B d 1 z λ i + D Z G k = n i=1 CZ i B d λ i k, k 1 D, k = 0 40
Poles and Stability Poles= eigenvalues of discrete-time state matrix A d = exponential functions of λ i A (continuous-time state matrix A). For stable A, λ i A have negative real parts and have magnitude less than unity. Discretization yields a stable DT system for a stable CT system. 41
Minimal Realizations Product CZ j B can vanish & eliminate eigenvalues from the transfer function: if CZ j = 0, Z j B = 0, or both. If cancellation occurs, the system is said to have an CZ j = 0 : output-decoupling zero at λ j Z j B = 0: an input-decoupling zero at λ j CZ j = 0, & Z j B = 0: an input-output-decoupling zero at λ j Poles of the reduced transfer function are a subset of the eigenvalues of the state matrix A d. A state-space realization that leads to pole-zero cancellation is said to be reducible or nonminimal. If no cancellation occurs, the realization is said to be irreducible or minimal. 42
Decoupling Modes Output-decoupling zero at λ j : the forced system response does not include the mode λ j k. Input-decoupling zero: the mode is decoupled from or unaffected by the input. Input-output-decoupling zero: the mode is decoupled both from the input and the output. These properties are related to the concepts of controllability and observability discussed later in this chapter. 43
Example 7.17 Obtain the z-transfer function for the position control system of Example 7.16 (a) With x 1 as output. (b) With x 1 + x 2 as output. The resolvent matrix and input matrix were obtained in Example 7.16. 44
Solution Φ z z 1 = 2 1 1 1 + 1 1 2 1 z e 0.1 2 2 z e 0.2 B d = 1/2 1 0 1 e 0.1 1 e 0.2 2 2 = 0.0045 0.861 (a) Output x 1 : C = 1 0, D = 0 2 1 1 2 1 G z = z e 1 0 0.1 0.0045 1 1 1 0.861 + 2 2 z e 0.2 9.5163 10 2 9.0635 10 2 = z e 0.1 z e 0.2 45
(c) Output x 1 +x 2 2 1 z 2 1 G z = z e 1 1 0.1 0.0045 1 1 z 0.861 + 2 2 z e 0.2 0 9.0635 10 2 = + z e 0.1 z e 0.2 1. Output-decoupling zero at e 0.1 since CZ 1 = [0] 2. System response to any input does not include the decoupling term. 46
Step Response 9.0635 10 2 Y z = z e 0.2 z z 1 9.0635 10 2 z = 1 e 0.2 z 1 + 1 z z e 0.2 z = 0.5 z 1 + 1 z z e 0.2 Z-transform inverse y k = 0.5 1 e 0.2k 47
z-transfer Function: MATLAB Let T = 0.05s» P = ss(ad, Bd, C, D, 0.05)» g = tf(p) % Obtain z-domain transfer function» zpk(g) % Obtain transfer function poles and zeros The command reveals that the system has a zero at 0.9048 and poles at (0.9048, 0.8187) with a gain of 0.09035. With pole-zero cancellation, the transfer function is the same as that of Example 7.17(b).» minreal(g) % Cancel poles and zeros 48