SIGNALS AND SYSTEMS: PAPER 3C1 HANDOUT 10. Dr David Corrigan1 . Electronic and Electrical Engineering Dept. corrigad@tcd.ie www.mee.tcd.ie/∼corrigad The Z Transform, System Transfer Function, Poles and Stability • For differential equations and analogue system analysis, the Laplace Transform is an invaluable tool. It allows us to examine stability through the simple exercise of pole-zero plots and also allows us to understand frequency response of systems through factorisation. • A similar tool exists for digital signals, it is called the Z Transform. It helps us avoid alot of tedious difference equation manipulation. • You probably have had enough of transforms in this course, so rather than heap upon you a large amount of proofs, we will just be stating what the Z-Transform is and then we’ll use it to do stuff. • Where possible, we will be using similar analysis for Z- Transforms as we did for Laplace transforms and so the proofs and so on will be much more brief. 1 This handout is based on the set of notes produced by Prof. Anil Kokaram 3C1 Signals and Systems 1 www.sigmedia.tv 1 THE Z-XFORM 1 The Z-Xform • The unilateral Z-Transform of a digital sequence xn is given by Z(xn) = X(z) = ∞ ∑ xnz −n n=0 • z is just a complex number in what is called the z−plane. Just like s is a complex number in the s− plane. • The Z-Transform maps a discrete sequence xn from the sample domain [n] into the complex plane z. • It is a power series in z Z(xn) = X(z) = ∞ ∑ xnz −n n=0 • Recall the unilateral Laplace Transform ∫ ∞ L (x(t)) = X(s) = x(t)e−stdt 0 3C1 Signals and Systems 2 www.sigmedia.tv 1 THE Z-XFORM Z(xn) = X(z) = ∞ ∑ xnz −n n=0 • Calculating the Z-transform of a finite length signal is straightforward. • An example. Say xn = 1, 2, −1, 0.5, 0.25, 0, 0 and 0 otherwise, furthermore xn is causal. The Z Transform of xn is then as follows. Z(xn) = X(z) = ∞ ∑ xnz −n n=0 = x0z 0 + x1z −1 + x2z −2 + x3z −3 . . . = 1 + 2z −1 − 1z −2 + 0.5z −3 + 0.25z −4 And that’s it. The Z-transform just takes an input sequence and multiplies it by increasing negative powers of z to create a power series in z. 3C1 Signals and Systems 3 www.sigmedia.tv 1 THE Z-XFORM • An important case. xn = rn where |r| < 1 X(z) = = = ∞ ∑ n=0 ∞ ∑ xnz −n rnz −n n=0 ∞ ( ∑ rz −1 )n n=0 Sum to infinity of a Geometric Progression a, ar, ar2, ar3, . . . a . Comparing this to our formula for X(z), it is a GP with is 1−r a = 1 and common ratio rz −1. So X(z) = rn ↔ 1 1 − rz −1 1 1 − rz −1 • What about the inverse? Well, the fancy way of doing the inverse is to do contour integration of X(z) in the z-plane to get back xn. But we’re going to use two simpler methods. One is just plain cheating and the other is to use tables2. 2 Also a form of cheating 3C1 Signals and Systems 4 www.sigmedia.tv 1.1 Inverse Z-Xform 1 1.1 1 THE Z-XFORM The Inverse Z-Transform: The plain cheat Z(xn) = X(z) = ∞ ∑ xnz −n n=0 Suppose we are given X(z) = −1 + z −1 + 0.1z −2 + 0.8z −3 + 1.2z −4. What is xn? Well, the Z-Transform of xn is a power series in z right? X(z) = ∞ ∑ xnz −n n=0 = x0z 0 + x1z −1 + x2z −2 + x3z −3 . . . Compare this with what we are given X(z) = −1 + z −1 + 0.1z −2 + 0.8z −3 + 1.2z −4 You can see that the coefficients of the power series are the values of xn themselves! So we can extract the inverse from the power series to yield xn = −1, 1, 0.1, 0.8, 1.2 Magic! 3C1 Signals and Systems 5 www.sigmedia.tv 1.2 Inverse Z-Xform 2 1.2 1 THE Z-XFORM The Inverse Z-Transform: The tables cheat Suppose we are given X(z) as follows. What is xn? 3 − 56 z −1 X(z) = (1 − 14 z −1)(1 − 31 z −1) (1) Use partial fractions 3 − 56 z −1 A B = + (1 − 14 z −1)(1 − 13 z −1) 1 − 14 z −1 1 − 13 z −1 Use cover up rule for A, B Put z −1 Put z −1 3 − 20 6 = 4 and cover up A = 1 − 34 = −1 3 − 15 6 = 3 and cover up B = 1 − 43 =2 Hence: 3 − 56 z −1 −1 2 + = (1 − 14 z −1)(1 − 13 z −1) 1 − 14 z −1 1 − 13 z −1 ( )n ( )n 1 1 Z −1(X(z)) = xn = −1 +2 4 3 3C1 Signals and Systems 6 www.sigmedia.tv 2 SOME Z XFORMS 2 Some Z Xforms • Given xn = δn what is Z(xn)? X(z) = = ∞ ∑ n=0 ∞ ∑ xnz −n δnz −n n=0 But δn is a sequence that is unity only where n = 0, otherwise its 0. Hence = 1 × z −0 + 0 × z −1 + 0 × z −2 + . . . =1 • Given xn = un what is Z(xn)? (The Z-xform of a step function) X(z) = = ∞ ∑ n=0 ∞ ∑ xnz −n unz −n n=0 But un is a sequence that is unity for all n ≥ 0. Hence = ∞ ∑ z −n n=0 Remember sum to ∞ of a GP is a/(1 − r), and here common ratio is z −1 = 3C1 Signals and Systems 7 1 1 − z −1 www.sigmedia.tv 3 SOME Z-XFORM RELATIONS 3 Some Z-Xform Relations • Convolution. Assuming xn and yn are causal what is the Z-Xform of the convolution of xn and yn? Let wn = xn ∗ yn ∞ ∑ wn = xn ∗ yn = xk yn−k ⇒ Z{wn} = = k=−∞ ∞ ∑ wnz −n n=0 ∞ ( ∑ n=0 Let m = n − k = ∞ ∑ ) xk yn−k z −n k=−∞ ∞ ( ∑ ∞ ∑ m=−k ) xk ym z −(m+k) k=−∞ Collect together the summations of like terms . . . (∑ )( ∑ ) ∞ ∞ = xk z −k ymz −m k=−∞ ∞ ∑ m=−k ( = xk z −k k = −∞ = X(z)Y(z) )( ∞ ∑ ymz −m ) m = −k This is THE SAME AS the relationship between TIME DOMAIN CONVOLUTION AND THE LAPLACE OR FOURIER XFORMS. 3C1 Signals and Systems 8 www.sigmedia.tv 3 SOME Z-XFORM RELATIONS • Time shift (very important in digital systems theory). If xn ↔ X(z) what is the Z-Xform of xn−1? Let yn = xn−1 ∞ ∑ Z(yn) = ynz −n = n=0 ∞ ∑ xn−1z −n n=0 Substitute m = n − 1 = = ∞ ∑ m=−1 ∞ ∑ xmz −(m+1) xmz −mz −1 m=−1 ∞ ∑ −1 =z xmz −m + z −1x−1z m=0 = z −1X(z) + x−1 But we are dealing with CAUSAL signals so ... Z(yn) = z −1X(z) So z −1 represents a shift in time of ONE SAMPLE. Hence Z{xn} = z −1X(z); Z{xn−2} = z −2X(z); Z{xn−3} = z −3X(z); and so on. • Note that we are assuming that the signal is causal. See tables for exact Z-Xforms of non-causal signals. 3C1 Signals and Systems 9 www.sigmedia.tv 4 SYSTEM XFER FUNCTIONS 4 System Xfer Functions • Now we are in a position to make it easier to manipulate difference equations using the Z-Xform, in the same way that we can use the Laplace Xform to help us solve differential equations. • Lets look at our simple IIR difference equation example again yn − 0.9yn−1 = xn (2) Let’s try to find an expression for the output Y(z) in terms of X(z). Take Z-Xforms of both sides remembering yn ↔ Y(z) yn−1 ↔ z −1 Y(z) xn ↔ X(z) So taking Z-Xforms we have Y(z) − 0.9Y(z)z −1 = X(z) ⇒ Y(z)[1 − 0.9z −1 ] = X(z) 1 1 − 0.9z −1 Y(z) 1 ⇒ = X(z) 1 − 0.9z −1 ⇒ Y(z) = X(z) Y(z) The function X(z) is the SYSTEM TRANSFER FUNCTION for the difference equation. And given xn we can use the above to work out the output given ANY input using the Z-Xform. • ALL THE SAME METHODOLOGY AS FOR ANALOGUE SYSTEM TRANSFER FUNCTIONS ALSO APPLIES INCLUDING THE BLOCK DIAGRAM ALGEBRA. • Thus if two systems G1 (z) and G2 (z) are in cascade the NET transfer function is G1 (z)G2 (z). 3C1 Signals and Systems 10 www.sigmedia.tv 4.1 BLOCK DIAGRAMS 4.1 4 SYSTEM XFER FUNCTIONS BLOCK DIAGRAMS yn + 0.2yn−1 − 0.48yn−2 = xn + 0.5xn−1 ⇒ yn = 0.48yn−2 − 0.2yn−1 + xn + 0.5xn−1 Y(z) = Y(z)[0.48z −2 − 0.2z −1 ] + X(z)[1 + 0.5z −1 ] x[n] y[n] T X(z) -1 0.5 0.48 -0.2 T T z-1 X(z) Y(z) 0.5 z -0.2 0.48 z-2 Y(z) z-1 3C1 Signals and Systems z-1 Y(z) 11 z-1 www.sigmedia.tv 4.2 Example 1 4.2 4 SYSTEM XFER FUNCTIONS Example 1 Given xn = δn input into the system G(z) = 1/(1 − 0.9z −1), what is the output hn? (This is another way of asking you to calculate the impulse response of the system G(z)). Let hn be the output sequence (the impulse response). BTW: G(z) is IIR. H(z) = G(z)X(z) X(z) = Z(δn) = 1 ⇒ H(z) = G(z) ⇒ hn = Z −1(G(z)) 1 = Z −1( ) 1 − 0.9z −1 From tables hn = 0.9n THE SYSTEM IMPULSE RESPONSE IS THE INVERSE Z XFORM OF THE SYSTEM TRANSFER FUNCTION. in exactly the same way that the time domain impulse response of an analogue system is the inverse Laplace Xform of its system transfer function. 3C1 Signals and Systems 12 www.sigmedia.tv 4.3 Example 2 4.3 4 SYSTEM XFER FUNCTIONS Example 2 Given xn = un (the step function) input into the system G(z) = 1/(1 − 0.9z −1), what is the output yn? (This is another way of asking you to calculate the step response of the system G(z)). BTW: G(z) is IIR. yn is the output sequence (the step response in this case). Y(z) = G(z)X(z) 1 1 − z −1 1 ⇒ Y(z) = G(z) −1 (1 − z ) G(z) ⇒ yn = Z −1 1 − z −1 ( ) 1 = Z −1 (1 − 0.9z −1)(1 − z −1) 1 −9 10 = + (1 − 0.9z −1)(1 − z −1) 1 − 0.9z −1 1 − z −1 yn = −9(.9)n + 10 X(z) = Z(un) = THE SYSTEM STEP RESPONSE IS THE INVERSE Z XFORM OF [ THE SYSTEM TRANSFER FUNCTION MULTIPLIED BY 1 ]. 1−z −1 in similar fashion to analogue systems. 3C1 Signals and Systems 13 www.sigmedia.tv 4.3 Example 2 4 SYSTEM XFER FUNCTIONS Impulse response of 1\(1−0.9z^{−1}) 1 0.8 0.6 0.4 0.2 0 0 10 20 Sample (n) 30 40 Step response of 1/(1−0.9z−1) 10 8 6 4 2 0 0 3C1 Signals and Systems 10 20 Sample (n) 14 30 40 www.sigmedia.tv 5 POLES AND ZEROS 5 Poles and Zeros • Same deal as for analogue systems. Poles are the values of z that make the denominator zero, and zeros are the values of z that make the numerator go to zero. NOT z −1, just z !!! 1 1 + 0.2z −1 − 0.48z −2 z2 = 2 z + 0.2z − 0.48 z2 = (z + 0.8)(z − 0.6) G(z) = (3) 1 0.8 0.6 Imaginary Part 0.4 0.2 2 0 −0.2 −0.4 −0.6 −0.8 −1 −1 −0.5 0 Real Part 0.5 1 You must always mark out the UNIT CIRCLE on the z-plane. We’ll see why next . . . 3C1 Signals and Systems 15 www.sigmedia.tv 6 STABILITY 6 Stability • Just like for analogue systems, a digital system is stable if its impulse response is absolutely summable i.e. ∞ ∑ |hn| = B < ∞ n=0 • A DIGITAL SYSTEM IS STABLE IF ALL ITS POLES LIE WITHIN THE UNIT CIRCLE IN THE Z-PLANE. We will not prove this in depth. Instead we will use the following example. • Lets look at the system G(z) as below 1 1 − az −1 This system has a pole at z = a, and a zero at z = 0 G(z) = • We know the impulse response of the system above is hn = an. Hence ∞ ∞ ∑ ∑ |hn| = |an| n=0 = n=0 ∞ ∑ |a|n n=0 • For this sequence to be stable it must have a finite sum. As ∑∞ n n=0 |a| repesents the sum of a geometric progession, the sum is finite if and only if |a| < 1 • That means that the POLE must be within the unit circle! • In general, to test stability for digital systems, just check that all the poles are within the unit circle. If any are not, then the 3C1 Signals and Systems 16 www.sigmedia.tv 6 STABILITY system is unstable. We have not proved this exactly, but you can get the picture. The proof is almost identical to what we did using the Analogue System Transfer Functions. • The location of zeros does not affect stability. • THEREFORE FIR FILTERS ARE ALWAYS STABLE! They do not have poles! • IIR Filters always have poles. • If poles lie ON the unit circle then the system may be marginally stable. We will not deal with that in this course. All you will need to know is that z-plane poles must lie WITHIN the unit circle for a digital system to be stable. 3C1 Signals and Systems 17 www.sigmedia.tv 6 STABILITY A relationship between the s and z planes Im Im Stable Systems have poles over here The Z-Transform maps the LHS of the S-Plane into the interior of the Unit Circle Re 1 1 -1 THE UNIT CIRCLE THE S-PLANE Re Stable Systems have poles in here -1 THE Z-PLANE Z-LAND LAPLACE-LAND DIGITAL ANALYSIS ANALOGUE ANALYSIS Why does it help? It turns out that if you are designing digital systems that will be processing signals generated by sampling, and then the output will be reconstructed to give an analogue signal, this connection helps. An example of this would be an audio processing system where an analogue signal from a microphone is digitized for processing before being converted back into an analogue signal and sent to a loudspeaker. But we will not be dealing with that in this course. That’s got more to do with design. In this course we just want you to get a handle on the tools, and the rough lay of the land. 3C1 Signals and Systems 18 www.sigmedia.tv