2. Z-transform and theorem E(s) R(s) M(s) Gc(s) Controller GP(s) Y(s) Plant GHP(z) R(z) M(z) E(z) ZOH Gc(z) A/D Y(z) GP(s) D/A Computer system Plant 2. Z-transform and theorem f(kT) f(t) A/D time Time kT f(kT) f(kT) D/A Time kT Time kT 2. Z-transform and theorem How can we represent the sampled data mathematically? For continuous time system, we have a mathematical tool Laplace transform. It helps us to define the transfer function of a control system, analyse system stability and design a controller. Can we have a similar mathematical tool for discrete time system? 2.1 Z-transform For a continuous signal f(t), its sampled data can be written as, f s (t ) f (kT ) f (0) f (T ) f (2T ) f (nT ) Then we can define Z-transform of f(t) as n 0 F ( z ) Z [ f (t )] Z [ f (nT )] f (nT ) z n n 0 f (0) f (T ) z 1 f (2T ) z 2 where z-1 represents one sampling period delay in time. 2.1 Z-transform Solution: Example 1: Find the Z-transform of unit step f(t) function. f(kT) t kT 2.1 Z-transform Apply the definition of Z-transform, we have F ( z ) Z [ f (t )] Z [ f (kT )] f (kT )z k k 0 1 z 1 z 2 a a aq aq aq 1 q 1 1 2 F ( z) 1 z z 1 z 1 2 3 2.1 Z-transform Another method F ( z ) Z [ f (t )] Z [ f (kT )] f ( kT )z k k 0 1 z 1 z 2 z 1 F ( z ) z 1 (1 z 1 z 2 ) z 1 z 2 z 3 1 1 F ( z) z F ( z) 1 F ( z) 1 z 1 2.1 Z-transform Example 2: Find the Z-transform of a exponential decay. f(t) Solution: f ( kT ) e akT t F ( z ) Z [ f ( kT )] e akT z k k 0 1 e aT z 1 e 2 aT z 2 1 F ( z) 1 e aT z 1 2.1 Z-transform Exercise 1: Find the Z-transform of a exponential decay f(t)=e-at using other method. f(t) t 2.1 Z-transform Example 3: Find the Z-transform of a cosine function. Solution: As e jt cost j sin t; e jt cost j sin t cost e jt e 2 jt ; sin t e jt e j2 jt 2.1 Z-transform e jt e jt 1 jt j t F ( z ) Z [coskT ] Z ( Z [ e ] Z [ e ]) 2 2 1 at Z [e ] 1 e aT z 1 jT 1 1 1 1 z 1 e jT z 1 1 1 e F ( z) jT 1 jT 1 2 1 e z 1 e z 2 (1 e jT z 1 )(1 e jT z 1 ) 1 2 (e jT z 1 e jT z 1 ) 2 2 z 1 cosT jT 1 jT 1 2 2 1 (e z e z ) z 2(1 2 z 1 cosT z 2 ) 1 z 1 cosT 1 2 z 1 cosT z 2 2.1 Z-transform Exercise 2: Find the Z-transform for decayed cosine function f (t ) eat cost 1 z 1e aT cosT F ( z) 1 2 z 1e aT cosT e 2 aT z 2 2.1 Z-transform Example 4: Find the Z-transform for f (t ) 1 eat Solution: F ( z ) Z [ f (kT )] Z 1 e at Z [1] Z [e at ] 1 1 at Z [1] Z [ step] ; Z [e ] 1 1 z 1 e aT z 1 1 1 (1 e aT ) z 1 F ( z) 1 aT 1 1 z 1 e z (1 z 1 )(1 e aT z 1 ) 2.1 Z-transform Exercise 3: Find the Z-transform for f (t ) teat Tz 1e aT F ( z) (1 z 1e aT ) 2 2.1 Z-transform The functions can be given either in time domain as f(t) or in S-domain as F(s). They are equivalent. eg. a) A unit step function: 1(t) or 1/s b) A ramp function: t or 1/s2 c) f(t)=1-e-at or a/(s(s+a)) etc. 2.2 Z-transform theorems Linearity: If f(t) and g(t) are Z-transformable and and are scalar, then the linear combination f(t)+g(t) has the Ztransform Z[f(t)+g(t)]= F(z)+ G(z) 2.2 Z-transform theorems Shifting Theorem: Given that the Z-transform of f(t) is F(z), find the Z-transform for f(t-nT). f(t) f(t-nT) t nT t 2.2 Z-transform theorems If f(t)=0 for t<0 has the Z-transform F(z), then Z [ f (t nT )] z n F ( z ) and n 1 n k Z [ f (t nT )] z F ( z ) f (kT ) z k 0 Proving: By Z-transform definition, we have Z [ f (t nT )] f (kT nT ) z k k 0 f (kT nT ) z k 0 ( k n ) n z z n f (kT nT ) z k z nn k 0 ( k n ) f ( kT nT ) z k 0 2.2 Z-transform theorems Defining m=k-n, we have Z [ f (t nT )] z n f (kT nT ) z ( k n ) k 0 z n m f ( m T ) z m n Since f(mT)=0 for the above as m<0, we can rewrite Z [ f (t nT )] z n m n m n f ( m T ) z z f ( m T ) z z F ( z) m n m 0 Thus, if a function f(t) is delayed by nT, its Ztransform would be multiplied by z-n. Or, multiplication of a Z-transform by z-n has the effect of moving the function to the right by nT time. This is the so-called Shifting Theorem. 2.2 Z-transform theorems Final value theorem:Suppose that f(t), where f(t)=0 for t<0, has the Z-transform of F(z), then the final value of f(t) can be given by 1 lim f (t ) lim(1 z ) F ( z ) t z 1 There are other theorems for Z-transform. Please read the study book or textbook for more details. Theorem Name F ( z ) Z [ f (t )] f (kT ) z k Definition k 0 Z[k1 f1 (t ) k 2 f 2 (t )] k1 F1 ( z) k 2 F2 ( z) Z[e at f (t )] F ( ze aT ) z Z [ a t f (t )] F ( ) a Linearity Multiply by e-at Multiply by at Z[ f (t kT )] z k F ( z) Time Shift 1 n 1 Time Shift 2 Z [ f (t kT )] z k [ F ( z ) f (kT ) z k ] k 0 Z[ f (t ) f (t 1)] (1 z 1 ) F ( z) t F ( z) Z f ( )d 0 1 z 1 Differentiation Integration f () lim(1 z 1 ) F ( z ) Final Value f (0) lim F ( z ) Initial Value z 1 z f(t) F(s) F(z) (t) 1 1 u(t) 1 s 1 1 z 1 t 1 s2 Tz 1 (1 z 1 ) 2 e at e bt ba e-at 1 ( s a)(s b) 1 sa 1 – e-at a s( s a) sint s2 2 cost s s 2 e-atsint e-atcost 2 ( s a) 2 2 sa ( s a) 2 2 1 (e aT e bT ) z 1 aT 1 bT 1 b a (1 e z )(1 e z ) 1 1 e aT z 1 (1 e aT ) z 1 (1 z 1 )(1 e aT z 1 ) z 1 sin T 1 2 z 1 cosT z 2 1 z 1 cosT 1 2 z 1 cosT z 2 z 1e aT sin T 1 2 z 1e aT cosT e 2 aT z 2 1 z 1e aT cosT 1 2 z 1e aT cosT e 2 aT z 2 2.3 Z-transform examples Example 1: Assume that f(k)=0 for k<0, find the Ztransform of f(k)=9k(2k-1)-2k+3, k=0,1,2…. Solution: Obvious f(k) is a combination of three sub-function 9k(2k-1), 2k and 3. Therefore, first we can apply linearity theorem to f(k). Second, subfunction 9k(2k-1) can be considered as a product of k and 2-12k, then we can apply the theorem of multiply by ak. Finally, we can find the answer by combining these three together. 2.3 Z-transform examples F ( z ) Z [9k (2 k 1 ) 2 k 3] Z [9k (2 k 1 )] Z [2 k ] Z [3] -1 Tz z T z 1 z Z[t] ; Z [a t f (t )] F ; Z[1] (1 z 1 ) 2 ( z 1) 2 1 - z -1 z 1 a 1 z/2 k k Z [2 ] Z [2 1] z / 2 1 1 2 z 1 9 z 1 9 ( z / 2) 9 k k 1 k 1 Z [9k (2 )] Z [9k 2 2 ] Z [k 2 ] 2 (1 2 z 1 ) 2 2 (z/2 - 1) 2 1 3 1 z 9 F ( z ) Z [9k (2 k 1 )] Z [2 k ] Z [3] (1 2 z 1 ) 2 1 2 z 1 1 z 1 2 z 2 (1 2 z 1 ) 2 (1 z 1 ) 2.3 Z-transform examples Example 2: Obtain the Z-transform of the curve x(t) shown below. f(t) 1 0 1 2 3 4 5 6 7 8 t 2.3 Z-transform examples Solution: From the figure, we have K 0 1 2 3 4 5 6… f(k) 0 0 0 1/3 2/3 1 1… Apply the definition of Z-transform, we have F ( z ) f (k ) z k k 0 z 3 2 z 4 000 z 5 z 6 3 3 z -3 2 z 4 z 5 (1 z 1 z 2 ) 3 z -3 2 z 4 z 5 z 3 z 4 z 5 1 3 1 z 3(1 z 1 ) 2.3 Z-transform examples a2 Example 3: Find the Z-transform of F ( s) 2 s ( s a) Solution: Apply partial fraction to make F(s) as a sum of simpler terms. k3 a2 k1 k 2 a 1 1 F (s) 2 2 2 s (s a) s s sa s s sa a 1 1 F ( z ) Z [ F ( s )] Z [ 2 ] Z [ ] Z [ ] s s sa aTz1 1 1 1 2 1 (1 z ) 1 z 1 e aT z 1 [(aT 1 e aT ) (1 e aT aTe aT ) z 1 ] z 1 (1 z 1 ) 2 (1 e aT z 1 ) 2.4 Inverse Z-transform The inverse Z-transform: When F(z), the Ztransform of f(kT) or f(t), is given, the operation that determines the corresponding time sequence f(kT) is called as the Inverse Z-transform. We label inverse Z-transform as Z-1. bo b1 z 1 b2 z 2 bm z m F ( z ) Z [ f (kT )] Z [ f (t )] 1 ao z 1 a1 z 2 an z n 1 2 m b b z b z b z 1 1 o 1 2 m f (kT ) Z [ F ( z )] Z 1 2 n 1 a z a z a z o 1 n 2.4 Inverse Z-transform Z-transform = Inverse Z-transform 2.4 Inverse Z-transform The inverse Z-transform can yield the corresponding time sequence f(kt) uniquely. However, it says nothing about f(t). There might be numerous f(t) for a given f(kT). f(t) 0 T 2T 3T 4T 5T 6T t 2.4 Inverse Z-transform x(kT) Zero-order Hold Low-pass Filter f(t) 2.5 Methods for Inverse Z-transform How can we find the time sequence for a given Z-transform? 1) Z-transform table Example 1: F(z)=1/(1-z-1), find f(kT). F(z)=1+z-1+z-2+z-3+… f(kT)=Z-1[F(z)]=1, for k=0, 1, 2, … 2.5 Inverse Z-transform examples (1 e aT ) z 1 Example 2: Given F ( z ) , 1 aT 1 (1 z )(1 e z ) Find f(kT). Solution: Apply partial-fraction-expansion to simplify F(z), then find the simpler terms from the Z-transform table. (1 e aT ) z 1 k1 k2 F ( z) 1 aT 1 1 (1 z )(1 e z ) 1 z 1 eaT z 1 Then we need to determine k1 and k2 2.5 Inverse Z-transform examples (1 e aT ) z 1 k1 k2 F ( z) 1 aT 1 1 (1 z )(1 e z ) 1 z 1 eaT z 1 Multiply (1-z-1) to both side and let z-1=1, we have aT 1 ( 1 e ) z k1 k2 1 1 (1 z ) ( 1 z ) 1 aT 1 1 aT 1 (1 z )(1 e z ) 1 e z 1 z (1 e aT ) z 1 (1 z 1 )k 2 (1 e aT ) z 1 k1 k1 aT 1 aT 1 1 e z 1 e z 1 e aT z 1 1 z 1 1 2.5 Inverse Z-transform examples Similar as the above, we let multiply (1-e-aTz-1) to both side and let z-1 =eaT, we have (1 e aT (1 e aT ) z 1 k1 k2 aT 1 z ) ( 1 e z ) 1 aT 1 1 aT 1 (1 z )(1 e z ) 1 e z 1 z 1 (1 e aT ) z 1 (1 e aT z 1 )k1 (1 e aT ) z 1 k2 k2 1 1 1 z 1 z 1 z 1 Finally, we have 1 z 1 e aT (1 e aT ) z 1 1 1 F ( z) 1 aT 1 1 (1 z )(1 e z ) 1 z 1 e aT z 1 f (kT ) 1 e akT , k 0,1,2, 2.5 Inverse Z-transform examples Exercise 4: Given the Z-transform 1 z F ( z) (1 z 1 )(1 1.3z 1 0.4 z 2 ) Determine the initial and final values of f(kT), the inverse Z-transform of F(z), in a closed form. Hint: Partial-fraction-expansion, then use Ztransform table, and finally applying initial & final value theorems of Z-transform. 2.5 Inverse Z-transform examples 2) Direct division method Example 1: F(z)=1/(1+z-1), find f(kT). 1 2 1 z 1 1 1 z z 1 1 z 1 1 z 1 1 1 z 1 1 1 z 1 1 z 1 1 z 1 -z 1 -z 1 -z z 1 z 2 z 1 z 2 z -2 1 z -2 2.5 Inverse Z-transform examples Finally, we obtain: F(z)=1-z-1+z-2-z-3+… K = 0 1 2 3 … F(kT)= 1 -1 1 -1 1 1 2z Example 2: Given F ( z) 1 2 (1 z ) Find f(kT). Solution: Dividing the numerator by the denominator, we obtain , 1 4 z 1 7 z 2 1 2 z 1 z 2 1 2 z 1 1 2 z 1 z 2 4 z 1 z 2 4 z 1 8 z 2 4 z 3 7 z 2 4 z 3 7 z 2 14z 3 7 z 4 10z 3 7 z 4 10z 3 20z 4 10z 5 13z 4 10z 5 2.5 Inverse Z-transform examples Finally, we obtain: F(z)=1+ 4z-1 + 7z-2 + 10z-3+… K = 0 1 2 3 … F(kT)= 1 4 7 10… Exercise 0.3679z 1 0.343z 2 0.02221z 3 0.05659z 4 5:F ( z) , 1 1 1.3679z 0.3679z 2 Find f(kT). Ans. :k f(kT) 0 0 1 2 3 0.3679 0.8463 1 4 1 5… 1… 2.5 Inverse Z-transform examples 3) Computational method using Matlab 1 1 2 z Example: Given F ( z ) find f(kT). (1 z 1 ) 2 1 2 z 1 z 2 2z z 2 2z F ( z) 2 1 2 2 (1 z ) ( z 1) z 2z 1 Solution: num=[1 2 0]; den=[1 –2 1] Say we want the value of f(kT) for k=0 to 30 u=[1 zeros(1,30)]; F=filter(num, den, u) 1 4 7 10 13 16 19 22 25 28 31… 2.5 Inverse Z-transform examples Exercise 6: Given the Z-transform z 1 (0.5 z 1 ) F ( z) 1 1 2 (1 0.5z )(1 0.8z ) Use 1) the partial-fraction-expansion method and 2) the Matlab to find the inverse Z-transform of F(z). Answer: x(k)=-8.3333(0.5)k+8.333(0.8)k-2k(0.8)k-1 x(k)=0;0.5;0.05;–0.615;–1.2035;-1.6257;-1.8778… Reading Study book • Module 2: The Z-transform and theorems Textbook • Chapter 2 : The Z-transform (pp23-50) Tutorial Exercise: The frequency spectrum of a continuoustime signal is shown below. 1) What is the minimum sampling frequency for this signal to be sampled without aliasing. 2) If the above process were to be sampled at 10 Krad/s, sketch the resulting spectrum from –20 Krad/s to 20 Krad/s. F() Krad/s -8 -4 4 8 Tutorial Solution: 1) From the spectrum, we can see that the bandwidth of the continuous signal is 8 Krad/s. The Sampling Theorem says that the sampling frequency must be at least twice the highest frequency component of the signal. Therefore, the minimum sampling frequency for this signal is 2*8=16 Krad/s. F() Krad/s -8 -4 4 8 Tutorial 2) Spectrum of the sampled signal is formed by shifting up and down the spectrum of the original signal along the frequency axis at i times of sampling frequency. As s=10 Krad/s, for i =0, we have the figure in bold line. For i=1, we have the figure in bold-dot line. F() -8 -4 2 4 6 8 10 12 14 16 18 Krad/s Tutorial For I=-1, 2,… we have -18 -14 -8 -6 -4 -2 F() 2 4 6 8 10 12 14 16 18 Krad/s 2 4 6 8 10 12 14 16 18 Krad/s Tutorial Exercise 1: Find the Z-transform of a exponential decay f(t)=e-aT using other method. f(t) t Tutorial F ( z ) Z [ f (t )] Z [ f (kT )] f (kT ) k 0 1 e aT z 1 e 2 aT z 2 e aT z 1 F ( z ) e aT z 1 (1 e aT z 1 e 2 aT z 2 ) e aT z 1 e 2 aT z 2 e 3aT z 3 F ( z) e aT 1 z F ( z) 1 F ( z) 1 1 e aT z 1 Tutorial Exercise 2: Find the Z-transform for a decayed cosine function f (t ) eat cost Solution 1: Z cost 1 z 1 cosT F ( z ) 1 2 z 1 cosT z 2 Z [ f (t )] F ( z ); F [e at f (t )] F ( ze aT ) 1 1 z cosT at Z [e cost ] 1 2 z 1 cosT z 2 1 e aT z 1 cosT 1 2e aT z 1 cosT e 2 aT z 2 z e aT z Tutorial Solution 2: at jt at jt e e at F ( z ) Z [e cost ] Z 2 1 ( Z [e at jt ] Z [e at jt ]) 2 1 at Z [e ] 1 e aT z 1 1 1 1 F ( z) aT jT 1 2 1 e z 1 e aT jT z 1 1 e aT z 1 cosT 1 2e aT z 1 cosT e 2 aT z 2 Tutorial Exercise 3: Find the Z-transform for f (t ) teat Solution: Tz 1 Z t F ( z) 1 2 (1 z ) Z [ f (t )] F ( z ); F [e at f (t )] F ( ze aT ) 1 Tz Z [te at ] (1 z 1 ) 2 Te aT z 1 (1 e aT z 1 ) 2 z e aT z Tutorial Exercise 4: Given the Z-transform 1 z F ( z) (1 z 1 )(1 1.3z 1 0.4 z 2 ) Determine the initial and final values of f(kT), the inverse Z-transform of F(z), in a closed form. Solution: Apply the initial value theorem and the final value theorem respectively, we have Tutorial f (0) lim F ( z ) lim z z z 1 0 1 1 2 (1 z )(1 1.3z 0.4 z ) f () lim [(1 z 1 ) F ( z )] lim z 1 z (1 z 1 ) z 1 1 (1 z 1 )(1 1.3z 1 0.4 z 2 ) 2.7 z 1 z 1 F ( z) 1 1 2 (1 z )(1 1.3z 0.4 z ) (1 z 1 )(1 0.8 z 1 )(1 0.5 z 1 ) k3 k1 k2 0.37 1.11 1.48 1 z 1 1 0.5 z 1 1 0.8 z 1 1 z 1 1 0.5 z 1 1 0.8 z 1 1 f (k ) (1 3(0.5) k 4(0.8) k ) 27 Tutorial Exercise 5: Given 0.3679z 1 0.343z 2 0.02221z 3 0.05659z 4 F ( z) 1 1.3679z 1 0.3679z 2 Find f(kT) using direct-division method. Solution: 1 1.3679z 1 0.3679z 2 0.3679z 1 0.3679z 1 0.343z 2 0.02221z 3 0.0565z 4 0.3679z 1 0.5033z 2 0.1354z 3 0.8463z 2 0.1576z 3 0.0565z 4 Tutorial Continuous 1 1.3679z 1 0.3679z 2 0.3679z 1 0.8463z 2 z 3 z 4 0.3679z 1 0.343z 2 0.02221z 3 0.0565z 4 0.3679z 1 0.5033z 2 0.1354z 3 0.8463z 2 0.1576z 3 0.0565z 4 0.8463z 2 1.1576z 3 0.3114z 4 z 3 0.3679z 4 z 3 1.3679z 4 0.3679z 5 z 4 0.3679z 5 f (k ) 0.3679z 1 0.8463z 2 z 3 z 4 Tutorial Exercise 6: Given the Z-transform z 1 (0.5 z 1 ) F ( z) 1 1 2 (1 0.5z )(1 0.8z ) Use 1) the partial-fraction-expansion method and 2) the Matlab to find the inverse Z-transform of F(z). Solution1: To make the expanded terms more recognizable in the Z-transform table, we usually expand F(z)/z into partial fractions. z 1 (0.5 z 1 ) z (0.5 z 1) F ( z) 1 1 2 (1 0.5 z )(1 0.8 z ) ( z 0.5)(z 0.8) 2 k3 F ( z) 0.5 z 1 k1 k2 z ( z 0.5)(z 0.8) 2 ( z 0.5) ( z 0.8) 2 z 0.8 k1 k3 0.5 z 1 k2 ( z 0.5) ( z 0.5) 2 2 ( z 0.5)(z 0.8) z 0.8 ( z 0.5) ( z 0.8) 0.5 z 1 k 2 ( z 0.5) k3 ( z 0.5) k1 2 2 ( z 0.8) ( z 0.8) z 0.8 let z 0.5 k1 ( z 0.8) 2 0.5 z 1 ( z 0.8) 2 8.333 z 0.5 k3 0.5 z 1 k1 k2 2 ( z 0 . 8 ) 2 2 ( z 0.5)(z 0.8) z 0.8 ( z 0.5) ( z 0.8) k ( z 0.8) 0.5 z 1 k1 ( z 0.8) 2 0.5 z 1 k2 3 k2 2 z 0.5 z 0.5 z 0.5 ( z 0.5) z 0.8 k3 0.5 z 1 k1 k2 2 ( z 0.8) ( z 0.8) 2 2 ( z 0.5)(z 0.8) z 0.8 ( z 0.5) ( z 0.8) 2 k3 ( z 0.8) 0.5 z 1 k1 ( z 0.8) 2 k2 derivative z 0.5 z 0.5 z 0.5 0.5 z 1 k1 ( z 0.8) z 0.5 z 0.5 ' 0.5 z 1 k3 z 0.5 ' z 0.8 2 ' k3 ( z 0.5) k3 ( z 0.8) 0 ; let z 0.8 ( z 0.5) 0.5( z 0.5) (0.5 z 1) 0.5 * 0.3 0.6 8.333 2 2 ( z 0.5) 0.3 z 0.8 F ( z) 0.5 z 1 8.333 2 8.333 2 2 z ( z 0.5)(z 0.8) ( z 0.5) ( z 0.8) z 0.8 8.333 2 z 1 8.333 F ( z) (1 0.5 z 1 ) (1 0.8 z 1 ) 2 1 0.8 z 1 f (k ) 8.333(0.5) k 2(0.8) k 1 8.333(0.8) k Tutorial Partial fraction for inverse Z-transform F ( z ) b0 z m b1 z m 1 bm 1 z bm b0 z m b1 z m 1 bm 1 z bm n n 1 z z a0 z an 1 z an ( z p1 )(z p2 ) ( z pn ) an a1 a2 F ( z) ; ai ( z pi ) z p1 z p2 z pn z z pi If F(z)/z involve s a multiple pole, eg. P1, then a3 an F ( z ) b0 z m b1 z m1 bm1 z bm c1 c2 z ( z p1 ) 2 ( z p3 ) ( z pn ) ( z p1 ) 2 z p1 z p3 z pn ai ( z pi ) F ( z) F ( z) d F ( z) ; c1 ( z p1 ) 2 ; c2 ( z p1 ) 2 z z pi z z p1 dz z z p1 Tutorial Solution 2: Expand F(z) into a polynomial form z 1 (0.5 z 1 ) 0.5z 1 z 2 F ( z) 1 1 2 (1 0.5z )(1 0.8z ) 1 2.1z 1 1.44z 2 0.32z 3 Num=[0 0.5 –1 0]; Den=[1 –2.1 1.44 –0.32]; U==[1 zeros(1,40)]; F=filter(Num, den,U) 0 0.5 0.05 -0.615 -1.2035…