Automatic Control 1 Z-transform Prof. Alberto Bemporad University of Trento Academic year 21-211 Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 1 / 21
Z-transform Z-transform Consider a function f(k), f :, f(k) = for all k < Definition The unilateral Z-transform of f(k) is the function of the complex variable z defined by F(z) =.8.6 f(k)z k.4.2 2 2 4 6 8 1 k= f(k) 2 1.8 1.6 1.4 1.2 1 k Once F(z) is computed using the series, it s extended to all z for which F(z) makes sense Witold Hurewicz (194-1956) Z-transforms convert difference equations into algebraic equations. It can be considered as a discrete equivalent of the Laplace transform. Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 2 / 21
Z-transform Examples of Z-transforms Discrete impulse if k f(k) = δ(k) 1 if k = [δ] = F(z) = 1 Discrete step if k < f(k) = 1I(k) 1 if k [1I] = F(z) = z z 1 Geometric sequence f(k) = a k 1I(k) [f] = F(z) = z z a Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 3 / 21
Z-transform Properties of Z-transforms Linearity [k 1 f 1 (k) + k 2 f 2 (k)] = k 1 [f 1 (k)] + k 2 [f 2 (k)] Example: f(k) = 3δ(k) 5 2 k 1I(t) [f] = 3 5z z 1 2 Forward shift 1 [f(k + 1) 1I(k)] = z [f] zf() Example: f(k) = a k+1 1I(k) [f] = z z z a z = az z a 1 z is also called forward shift operator Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 4 / 21
Z-transform Properties of Z-transforms Backward shift or unit delay 2 [f(k 1) 1I(k)] = z 1 [f] Example: f(k) = 1I(k 1) [f] = z z(z 1) Multiplication by k [kf(k)] = z d [f] dz Example: f(k) = k 1I(k) [f] = z (z 1) 2 2 z 1 is also called backward shift operator Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 5 / 21
Z-transform Initial and final value theorems Initial value theorem f() = lim z F(z) Example: f(k) = 1I(k) k 1I(k) F(z) = f() = lim z F(z) = 1 z z 1 z (z 1) 2 Final value theorem lim k + f(k) = lim(z 1)F(z) z 1 Example: f(k) = 1I(k) + (.7) k 1I(t) F(z) = f(+ ) = lim z 1 (z 1)F(z) = 1 z z 1 + z z+.7 Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 6 / 21
Transfer functions Discrete-time transfer function Let s apply the Z-transform to discrete-time linear systems x(k + 1) = Ax(k) + Bu(k) y(k) = Cx(k) + Du(k) x() = x Define X(z) = [x(k)], U(z) = [u(k)], Y(z) = [y(k)] Apply linearity and forward shift rules zx(z) zx = AX(z) + BU(z) Y(z) = CX(z) + DU(z) Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 7 / 21
Transfer functions Discrete-time transfer function X(z) = z(zi A) 1 x + (zi A) 1 BU(z) Y(z) = zc(zi A) 1 x }{{} + (C(zI A) 1 B + D)U(z) }{{} Z-transform of natural response Z-transform of forced response Definition: The transfer function of a discrete-time linear system (A, B, C, D) is the ratio G(z) = C(zI A) 1 B + D between the Z-transform Y(z) of the output and the Z-transform U(z) of the input signals for the initial state x = MATLAB»sys=ss(A,B,C,D,Ts);»G=tf(sys) Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 8 / 21
Transfer functions Discrete-time transfer function u(k) y(k) U(z) Y (z) A; B; C; D G(z) x = Example: The linear system x(k + 1) =.5 1 x(k) + u(k).5 1 y(k) = 1 1 x(k) with sampling time T s =.1 s has the transfer function z + 1.5 G(z) = z 2.25 Note: Even for discrete-time systems, the transfer function does not depend on the input u(k). It s only a property of the linear system MATLAB»sys=ss([.5 1; -.5],[;1],[1-1],,.1);»G=tf(sys) Transfer function: -z + 1.5 ---------- sˆ2 -.25 Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 9 / 21
Difference equation Difference equations Consider the n th -order difference equation forced by u a n y(k n) + a n 1 y(k n + 1) + + a 1 y(k 1) + y(k) = b n u(k n) + + b 1 u(k 1) For zero initial conditions we get the transfer function G(z) = = b n z n + b n 1 z n+1 + + b 1 z 1 a n z n + a n 1 z n+1 + + a 1 z 1 + 1 b 1 z n 1 + + b n 1 z + b n z n + a 1 z n 1 + + a n 1 z + a n Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 1 / 21
Difference equation Difference equations Example: 3y(k 2) + 2y(k 1) + y(k) = 2u(k 1) G(z) = 2z 1 3z 2 + 2z 1 + 1 = 2z z 2 + 2z + 3 Note: The same transfer function G(z) is obtained from the equivalent matrix form 1 x(k + 1) = x(k) + u(k) 3 2 1 y(k) = 2 x(k) G(z) = 2 z 1 1 1 1 3 2 1 Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 11 / 21
Difference equation Some common transfer functions Integrator x(k + 1) = x(k) + u(k) y(k) = x(k) U(z) 1 z 1 Y (z) Double integrator x 1 (k + 1) = x 1 (k) + x 2 (k) x 2 (k + 1) = x 2 (k) + u(k) y(k) = x 1 (k) U(z) 1 z 2 2z + 1 Y (z) Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 12 / 21
Difference equation Some common transfer functions Oscillator x 1 (k + 1) = x 1 (k) x 2 (k) + u(k) x 2 (k + 1) = x 1 (k) y(k) = 1 2 x 1(k) + 1 2 x 2(k) U(z) 1 2 z + 1 2 z 2 z + 1 Y (z) 2 output response 1 y(k) 1 2 1 2 3 4 5 6 k Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 13 / 21
Difference equation Impulse response Consider the impulsive input u(k) = δ(k), U(z) = 1. The corresponding output y(k) is called impulse response The Z-transform of y(k) is Y(z) = G(z) 1 = G(z) Therefore the impulse response coincides with the inverse Z-transform g(k) of the transfer function G(z) Example (integrator:) 2 2 1 1 u(k) = δ(k) y(k) = 1 1 z 1 = 1I(k 1) u(k) 1 2 2 2 4 6 8 1 k y(k) 1 2 2 2 4 6 8 1 k Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 14 / 21
Difference equation Poles, eigenvalues, modes Linear discrete-time system x(k + 1) = Ax(k) + Bu(k) y(k) = Cx(k) + Du(k) x() = G(z) = C(zI A) 1 B + D N G(z) D G (z) Use the adjugate matrix to represent the inverse of zi A The denominator D G (z) = det(zi A)! C(zI A) 1 C Adj(zI A)B B + D = + D det(zi A) The poles of G(z) coincide with the eigenvalues of A Well, as in continuous-time, not always... Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 15 / 21
Difference equation Steady-state solution and DC gain Let A asymptotically stable ( λ i < 1). Natural response vanishes asymptotically Assume constant u(k) u r, k. What is the asymptotic value x r = lim k x(k)? Impose x r (k + 1) = x r (k) = Ax r + Bu r and get x r = (I A) 1 Bu r The corresponding steady-state output y r = Cx r + Du r is Cf. final value theorem: y r = (C(I A) 1 B + D) }{{} DC gain y r = lim y(k) = lim(z 1)Y(z) k + z 1 = lim(z 1)G(z)U(z) = lim(z 1)G(z) u rz z 1 z 1 z 1 = G(1)u r = (C(I A) 1 B + D)u r G(1) is called the DC gain of the system Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 16 / 21 u r
Difference equation Example - Student dynamics Recall student dynamics in 3-years undergraduate course.2 1 x(k + 1) =.6.15 x(k) + u(k).8.8 y(k) =.9 x(k) DC gain: [.9 ] Transfer function: G(z) = 35 3 25 2 15 1 5 y(k) 26 28 21 212 214 216 step k 1 1 1.2.6.15.8.8 1 1.69.432 z 3.43z 2 +.58z.24, G(1).69 MATLAB»A=[b1 ; a1 b2 ; a2 b3];»b=[1;;];»c=[ a3];»d=[];»sys=ss(a,b,c,d,1);»dcgain(sys) ans =.695 For u(k) 5 students enrolled steadily, y(k).69 5 34.5 graduate Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 17 / 21
Algebraically equivalent systems Linear algebra recalls: Change of coordinates Let {v 1,..., v n } be a basis of n (= n linearly independent vectors) 1 The canonical basis of n 1 is e 1 =..., e 2 =...,..., e n =... A vector w n can be expressed as a linear combination of the basis vectors, whose coefficients are the coordinates in the corresponding basis w = n x i e i = i=1 n z i v i The relation between the coordinates x = [x 1... x n ] in the canonical basis and the coordinates z = [z 1... z n ] in the new basis is x = Tz where T = v 1... v n (= coordinate transformation matrix) i=1 1 Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 18 / 21
Algebraically equivalent systems Algebraically equivalent systems Consider the linear system x(k + 1) = Ax(k) + Bu(k) y(k) = Cx(k) + Du(k) x() = x Let T be invertible and define the change of coordinates x = Tz, z = T 1 x z(k + 1) = T 1 x(k + 1) = T 1 (Ax(k) + Bu(k)) = T 1 ATz(k) + T 1 Bu(k) y(k) = CTz(k) + Du(k) z = T 1 x and hence z(k + 1) = Ãz(k) + Bu(k) y(k) = Cz(k) + Du(k) z() = T 1 x The dynamical systems (A, B, C, D) and (Ã, B, C, D) are called algebraically equivalent Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 19 / 21
Algebraically equivalent systems Transfer function of algebraically equivalent systems Consider two algebraically equivalent systems (A, B, C, D) and (Ã, B, C, D) Ã = T 1 AT B = T 1 B C = CT D = D (A, B, C, D) and (Ã, B, C, D) have the same transfer functions: G(z) = C(zI Ã) 1 B + D = CT(zT 1 IT T 1 AT) 1 T 1 B + D = CTT 1 (zi A)TT 1 B + D = C(zI A) 1 B + D = G(z) The same result holds for continuous-time linear systems Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 2 / 21
Algebraically equivalent systems English-Italian Vocabulary Z-transform forward shift operator unit delay trasformata zeta operatore di anticipo ritardo unitario Translation is obvious otherwise. Prof. Alberto Bemporad (University of Trento) Automatic Control 1 Academic year 21-211 21 / 21