Hossein Sameti Department of Computer Engineering Sharif University of Technology Z {x(n)} X ( z ) x(n) z n Vs. n Complex function X ( ) x(n)e jn n Complex variable Q: Why do we need Z-transform? A: For some signals, Fourier transform does not converge. e.g.: x ( n) 2 n u ( n) • Relationship between X (z ) and X ( ) : X ( z) z e jw X ( ) Z-transform evaluated at unit circle corresponds to DTFT. The role of Z-transform in DT is similar to Laplace transform in CT. 2 Z {x(n)} X ( z ) x(n) z n n For what values of z, does the z-transform converge? z re j z z r X ( z ) x ( n) z n n x(n) re j n X ( z ) x(n) r n e jn n n DTFT of x( n)r n DTFT of x( n)r n exists if x( n)r n is absolutely summable. n x ( n) r n Z-transform exists and converges. Convergence only depends on r. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 3 • Region of Convergence (ROC): ROC is a region in “z” domain that n x(n) z n converges. n x ( n) r n ROC is radially symmetric. If Z-transform converges for z1 re j1 It also converges for z2 re j 2 • ROC does not depend on the angle. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 4 There are the following possibilities: 1. 2. 3. 4. 5. All Z-domain except one or two points (origin / infinity) Inside a circle Outside a circle Between two circles (ring) ROC does not exist Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 5 a n x ( n) 0 0 n N 1 X ( z ) x(n) z n Otherwise n X ( z ) 1 az 1 a 2 z 2 ... a N 1z N 1 a a2 a N 1 1 2 ... N 1 z z z ROC: everywhere except at the origin: z 0 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 6 a n x( n) 0 N n0 X ( z ) x(n) z n n Otherwise X ( z ) 1 a 1z a 2 z 2 ... a N z N ROC: everywhere except at infinity: z Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 7 x ( n) a n u ( n ) n n X ( z ) a z u ( n) a z n az 1 1 n n n0 X ( z) 1 n ( az ) n 0 1 1 az 1 a z Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 8 x(n) a nu(n 1) 1 n n X ( z) a z n a1z 1 a m m m 1 X ( z) z 1 (a 1 z ) m m0 1 1 az 1 z a • Same Z-transform as the previous example. However, the ROC is different. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 9 We have shown that X(z) needs the ROC to uniquely specify a sequence. x ( n) a n u ( n ) x(n) a nu(n 1) X ( z) 1 1 az 1 X ( z) 1 1 az 1 X ( z ) ROC1 x1 (n) X ( z ) ROC2 x2 (n) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 10 n n 1 1 x ( n) u ( n ) u ( n ) 2 3 n 1 1 X ( z ) z 1 z 1 n0 2 n 0 3 z 1 2 z n 1 3 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 11 n n 1 1 x(n) u (n) u (n 1) 3 2 1 1 n X ( z) z n 0 3 z 1 1 1 n z n 2 1 3 z 1 2 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 12 n n 1 1 x(n) u (n) u (n 1) 2 3 n 1 1 X ( z ) z 1 z 1 n 0 2 n 0 3 z 1 2 z n 1 3 Z-transform does not exist. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 13 (1) The ROC of X(z) consists of a ring in the z-plane centered about the origin (equivalent to a vertical strip in the s-plane) (2) The ROC does not contain any poles (same as in LT). Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 14 Book Chapter10: Section 1 (3) If x[n] is of finite duration, then the ROC is the entire zplane, except possibly at z = 0 and/or z = ∞. Why? N2 X ( z) xnz n n N1 Examples: CT counterpart n 1 ROC all z (t ) 1 ROC all s n 1 z 1 ROC z 0 (t T ) e sT es n 1 z ROC z (t T ) e sT es Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 15 Book Chapter10: Section 1 (4) If x[n] is a right-sided sequence, and if |z| = ro is in the ROC, then all finite values of z for which |z| > ro are also in the ROC. xn r1n n N1 converges faster tha n xn r0n n N1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 16 Book Chapter10: Section 1 (5) If x[n] is a left-sided sequence, and if |z| = ro is in the ROC, then all finite values of z for which 0 < |z| < ro are also in the ROC. (6) If x[n] is two-sided, and if |z| = ro is in the ROC, then the ROC consists of a ring in the z-plane including the circle |z| = ro. What types of signals do the following ROC correspond to? right-sided left-sided two-sided Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 17 Book Chapter10: Section 1 Example: xn b|n| , b0 xn b nun b n u n 1 From: b n un 1 , z b 1 1 bz 1 1 b n u n 1 , z b 1 b 1 z 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 18 Book Chapter10: Section 1 Example, continued 1 1 1 X ( z) , b z 1 1 1 b 1 bz 1 b z Clearly, ROC does not exist if b > 1 ⇒ No z-transform for b|n|. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 19 ROC is only a function of r. FLS ROC is everywhere except at the origin or infinity. RHS ROC is outside some circle. LHS ROC is inside some circle. BHS ROC is a ring or it does not exist. FT exists if ROC includes unit circle. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 20 Linearity: z x1 (n) X1 ( z ) ROC1 z x2 (n) X 2 ( z) ROC2 z x(n) a1x1 (n) a2 x2 (n) X ( z ) a1 X1 ( z ) a2 X 2 ( z ) ROC: at least the intersection of ROC1 and ROC2. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 21 Example: Solution: x(n) (cos 0n) u(n) x(n) (cos 0 n) u (n) Using linearity property: X ( z) ? 1 j 0 n e u ( n) 2 1 X ( z ) z{ e j0 nu (n) 2 Earlier we showed that: x(n) a u (n) n If we set: a e j0 x(n) e j0 nu (n) X ( z) 1 1 1 1 2 1 e j0 z 1 2 1 e j0 z 1 1 j 0 n e u ( n) 2 1 j 0 n e u (n)} 2 1 (a z) 1 az 1 1 X ( z) 1 e j0 z 1 ( z 1) X ( z) ( z 1) 1 z 1 cos 0 X ( z) 1 2 z 1 cos 0 z 2 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 22 z x(n) X ( z) ROC z x( n k ) z k X ( z) ROC: Similar ROC with some exceptions at 0 and infinity Example: x1 (n) {1 ,2,5,7,0,1} Z{x2 (n) x1(n 2)) ? X1 ( z ) 1 2 z 1 5 z 2 7 z 3 z 5 X 2 ( z ) z 2 2 z1 5 7 z 1 z 3 ROC? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 23 z x(n) X ( z) z a n x(n) X (a 1z ) ROC : r1 z r2 ROC : a r1 z a r2 Example: x(n) a n (cos 0 n) u (n) Earlier: x(n) (cos 0n) u(n) x(n) a (cos 0 n) u (n) n 1 z 1 cos 0 X ( z) 1 2 z 1 cos 0 z 2 1 az 1 cos 0 X ( z) 1 2az 1 cos 0 a 2 z 2 ( z 1) (z a) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 24 z x(n) X ( z) z x(n) X ( z 1 ) Example: x ( n) u ( n) Earlier: x ( n) a n u ( n ) x ( n) u ( n) x ( n) u ( n) ROC : r1 z r2 ROC : 1 1 z r2 r1 X ( z) ? 1 1 az 1 1 X ( z) 1 z 1 X ( z) X ( z) 1 1 z (z a) ( z 1) ( z 1) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 25 z x(n) X ( z) dX ( z ) z nx(n) z dz Example: x(n) na nu (n) Earlier: x1 (n) a nu (n) x2 (n) na nu (n) ROC ROC X ( z) ? 1 (z a) 1 1 az dX1 ( z ) az 1 (z a) X 2 ( z) z 1 2 dz (1 az ) X1( z) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 26 z x1 (n) X1 ( z ) ROC1 z x2 (n) X 2 ( z) ROC2 z x(n) x1 (n) * x2 (n) X ( z ) X 1 ( z ). X 2 ( z ) ROC: at least the intersection of ROC1 and ROC2 Example: x1 (n) 1 ,2,1 1, 0 n 5 x2 (n) 0, elsewhere X 1 ( z ) 1 2 z 1 z 2 x1(n) * x2 (n) ? X 2 ( z ) 1 z 1 z 2 z 3 z 4 z 5 X ( z ) X 1 ( z ) X 2 ( z ) 1 z 1 z 6 z 7 x(n) 1,1,0,0,0,0,1,1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 27 Inverse Z-Transform Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 28 Z {x(n)} x(n) z n x (n ) n ? X (z ) X (z ) x (n ) 1 n 1 X ( z ) z dz 2j C • Methods of calculating the inverse Z-transform: • Cauchy theorem for calculating the inverse Z-transform (not covered) • Series expansion • Partial fraction expansion and using look-up tables Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 29 • Basic concept: expand X(z) in terms of powers of z-1 X ( z ) cn z n n X ( z) 8z 3 5 20 z 4 X ( z ) x(n) z n ... x(1) z x(0) x(1) z 1 ... n x(n) 8 (n 3) 5 (n) 20 (n 4) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 30 Example: X ( z) log 1 az 1 ROC : z a x(n) ? x 1 x 2 x3 x 4 log(1 x) x ... 2 3 4 az 1 1 log(1 az 1 ) az 1 az az az 1 2 1 3 1 4 2 3 4 ... a2 a3 x(n) 0. (0) a (1) (2) (3) ... 2 3 an 1n 1u(n 1) x ( n) n Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 31 This method is applicable if we have a ratio of two polynomials in the form of X ( z) P( z). b0 b1z 1 ... bM z M Q( z ) a0 a1z 1 ... a N z N We would like to rewrite X(z) in the following manner: X ( z) a1 X1( z) a2 X 2 ( z) ... aN X N ( z) This expansion is performed in a way that the inverse Z-transform of X1( z), X 2 ( z),..., X N ( z) can be easily found using a lookup table and using the linearity property, we can find x(n): x(n) a1x1(n) a2 x2 (n) ... aN xN (n) Example: x ( n) a n u ( n ) x(n) na nu (n) 1 (z a) 1 1 az az 1 X ( z) (z a) 1 2 (1 az ) X ( z) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 32 Any non-constant single-variable polynomial of degree N can be factored into N terms: P( z ) a0 a1z1 a2 z 2 a3 z 3 k ( z z1 )( z z2 )( z z3 ) If the coefficients of the polynomial are real, then the roots are either real or complex conjugates. If z0 is a complex root, then z 0* is also a root. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 33 Example: 1 z2 X ( z) 2 1 2 1 1.5 z 0.5 z z 1.5 z 0.5 X ( z) z A1( z 0.5) A2 ( z 1) A A 1 2 z ( z 1)( z 0.5) z 1 z 0.5 ( z 1)( z 0.5) z A1( z 0.5) A2 ( z 1) 2z z 2 1 X ( z) 1 z 1 z 0.5 1 z 1 0.5z 1 ROC : z 1 z 1 A1 2 z 0.5 A2 1 x(n) 2.(1)n u(n) (0.5)n u(n) [2 0.5n ]u(n) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 34 Example: 1 X ( z) (1 z 1 )(1 z 1 ) 2 z3 ( z 1)( z 1) 2 A3 A1 A2 X ( z) z2 2 2 z 1 z 1 z 1 z ( z 1)( z 1) z 2 A1 ( z 1) 2 A2 ( z 1)( z 1) A3 ( z 1) 0.25 0.75 0.5z 1 X ( z) 1 z 1 1 z 1 (1 z 1 )2 x(n) causal x(n) 0.25(1) n u (n) 0.75(1) n u (n) 0.5n(1) n u (n) • In the case of complex conjugate roots, the coefficients in the partial fraction expansion will be complex conjugates. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 35 Example: 5 1 z A B 6 X ( z) 1 1 1 1 1 1 1 1 1 1 z 1 z z 1 z 1 z 1 z 4 3 4 3 4 3 3z 2 5 z 6 3 Partial Fraction Expansion Algebra: 1 1 1 z 1 4 x1 n X ( z) x[n] A = 1, B = 2 2 1 1 z 1 3 x2 n Note, particular to z-transforms: 1) When finding poles and zeros, express X(z) as a function of z. 2) When doing inverse z-transform using PFE, express X(z) as a function of z-1. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 36 z ROC III: 1 3 - right - sided singnal n 1 x1 n un 4 n 1 x2 n 2 un 3 ROC II: 1 1 z 4 3 - two - sided singnal n 1 x1 n un 4 n 1 x2 n 2 u n 1 3 ROC I: z 1 4 - left - sided singnal n 1 x1 n u n 1 4 n 1 x2 n 2 u n 1 3 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 37 Linear Constant- Coefficient Difference Equation (LCCDE) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 38 x(n),X(z) h(n),H (z) y(n),Y(z) y ( n) h( n) * x ( n) Y ( z ) H ( z ). X ( z ) LTI Systems h(n) FIR Use difference equations for implementation Transfer function IIR With rational transfer function P( z ) H ( z) Q( z ) No rational transfer function H ( z) P( z ) Q( z ) 39 Cumulative Average System: 1 n y ( n) x(k ), n 0,1,... n 1 k 0 n 1 (n 1) y (n) x(k ) x(n) k 0 ny ( n 1) x( n) y ( n) n 1 y (n 1) x ( n) n 1 n 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 40 The general form for a linear constant-coefficient difference equation is given by: N M k 1 k 0 Order of the system y (n) ak y (n k ) bk x(n k ) Given the difference equation of an IIR system and the initial condition of y(n), we can compute the output y(n) through the difference equation more efficiently using finite number of computations. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 41 Question: How can an LCCDE correspond to an LTI system? E.g.: y (n) ay (n 1) x(n) It is not even a system, since a unique input does not correspond to a unique output. Q: How can we show this? A: If y1 (n) is a solution, y2 (n) y1 (n) kan is also a solution. Q: How can we resolve this problem? A: We need to add an initial condition (I.C.). y (n) ay (n 1) x(n) x ( n ) b ( n ) IC : y(1) y0 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 42 y (n) ay (n 1) x(n) x ( n ) b ( n ) IC : y(1) y0 y(0) ay(1) b (0) ay0 b n 0: Causal implementation y (1) ay (0) 0 a(ay0 b) a 2 y0 ab y (n) a n (ay0 b) n 2 : y (n) ay (n 1) x(n) y (2) n 1 : 1 b 1 y (1) (1) y0 a a a 1 y (3) 2 y0 a 1 b y (n 1) y (n) (n) a a Anti-causal implementation y (n) a n1 y0 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 43 • By Combining the two answers, we get: y (n) a n (ay0 b)u (n) a n 1 y0u (n 1) y (n) a n 1 y0 a nbu (n) • Q: Does this system correspond to a linear system? y (n) ay (n 1) x(n) x ( n ) b ( n ) IC : y(1) y0 • A: No, zero input does not result in zero output. • An LCCDE corresponds to a linear system, when IC=0. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 44 • Q: Does this system correspond to a TI system? y (n) ay (n 1) x(n) x ( n ) b ( n ) IC : y(1) y0 y (n) a n 1 y0 a nbu (n) • A: Consider x(n) b (n) . Now let’s shift the input: w(n) b (n n0 ) Output: a n 1 y0 ba n n u (n n0 ) 0 y (n n0 ) a n n0 1 y0 ba n n0 u (n n0 ) Shift variant • In order for an LCCDE to correspond to a TI system, IC=0. (for 𝑛0 ≥ 0) • In order for an LCCDE to correspond to an LTI system, IC=0. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 45 In order an LCCDE to correspond to a causal LTI system : ◦ Initial rest condition (IRC)=0 E.g., if x(n) (n) , for a first order LCCDE, the IRC should be as follows: y (1) 0 E.g., if x(n) (n 3) , for a second order LCCDE, the IRC should be as follows: y(1) 0, y (2) 0 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 46 1 y (n) 0; n 0 y (n) y (n 1) 2 x(n) x(n 1) x(n 2) 2 1 h(n) h(n 1) 2 (n) (n 1) (n 2) 2 1 h ( n ) h(n 1) 2 (n) (n 1) (n 2) Solution1: n 1 n0 n 1 n2 n3 n3 2 h(1) 0 1 h(0) h(1) 2 (0) 0 0 0 2 0 0 2 2 1 1 h(1) h(0) 0 (0) 0 2 1 12 12 1 1 2 1 h(2) h(1) 0 0 (0) ( 2 1) 1 ( ) 2 ( ) 1 1 2 2 2 2 2 1 1 1 1 1 1 1 h(3) h(2) (( ) 2 2 ( ) 1 1) ( )3 2 ( ) 2 1 2 2 2 2 2 2 2 1 1 1 1 1 h(n 1) (( ) n 1 2 ( ) n 2 1 ( ) n 3 1) 2 2 2 2 2 1 1 1 ( ) n 2 ( ) n 1 1 ( ) n 2 1, n 3 47 2 2 2 h( n) Y ( z ) H ( z ). X ( z ) x(n),X(z) h(n),H (z) Y ( z) H ( z) X ( z) y(n),Y(z) 1 y (n 1) 2 x(n) x(n 1) x(n 2) 2 1 1 Y ( z ) z Y ( z ) 2 X ( z ) z 1 X ( z ) z 2 X ( z ) 2 y ( n) y (n) 0; n 0 Y ( z) 2 z 1 z 2 H ( z) 1 1 X ( z ) 1 z 1 1 z 1 1 1 z 1 2 2 2 Remember: x ( n) a n u ( n ) n 1 1 h( n) 2 u ( n) 2 2 X ( z) n 1 1 u (n 1) 2 1 1 az 1 (z a) n2 u (n 2) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 48 Z-transform with rational transfer function: M bk z k B( z ) b0 b1 z 1 ... bM z M X ( z) k 0 N A( z ) a a z 1 ... a z N k 0 1 N ak z k 0 Zero: X(z)=0 Pole: X(z)=∞ Getting rid of the negative powers: a0 0, b0 0 B( z ) b0 z M X ( z) A( z ) a0 z N b b z M 1 z M 1 ... M b0 b0 M N ( z z1 )( z z2 )...( z zM ) b0 z a a0 ( z p1 )( z p2 )...( z pN ) a z N 1 z N 1 ... N a0 a0 Poles and zeros? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 49 A pole-zero plot can represent X(z) graphically. Example: x1 (n) a nu (n) X1( z) 1 1 az 1 (z a) z X1( z) za Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 50 If a polynomial has real coefficients, its roots are either real or occur in complex conjugates. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 51 x ( n) a n u ( n ) X ( z) 1 1 az 1 (z a) 0 a 1 1 a 0 a 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 52 x ( n) a n u ( n ) X ( z) 1 1 az 1 (z a) a 1 a 1 a 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 53 az 1 X ( z) (1 az 1 )2 x(n) na u (n) n (z a) 0 a 1 1 a 0 a 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 54 az 1 X ( z) (1 az 1 )2 x(n) na u (n) n (z a) a 1 a 1 a 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 55 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 56 For BIBO stability of an LTI system, we shall have h( n) n Now, let’s see what happens in the z-domain: H ( z ) h( n) z H ( z ) h( n) z n n n z 1 H ( z) n h( n) z n n h( n) z n n h( n) z 1 n •CONCLUSION: an LTI system is BIBO stable iff the ROC of its impulse response includes the unit circle. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 57 Causal LTI systems have h(n) = 0 for n<0. ROC of the z-transform of a causal sequence is the exterior of a circle. CONCLUSION: an LTI system is causal iff the ROC of its system function is the exterior of a circle of radius r<∞ including the point z=∞. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 58 Conditions for stability and causality are different and one does not imply the other. A causal system might be stable or unstable just as a noncausal system can be stable or unstable. For causal systems though, the condition of stability can be narrowed since: ◦ A causal system has z-transform with ROC outside a circle of radius r. ◦ The ROC of a stable system must contain the unit circle. Then a causal and stable system ROC must be 𝑧 > 𝑟 with 𝑟 < 1. This means that a causal LTI system is BIBO stable iff all the poles of H(z) are inside the unit circle. 1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 59 3 4 z 1 1 2 H ( z) 1 3.5 z 1 1.5 z 2 1 12 z 1 1 3z 1 Example: Specify ROC and h(n) for the following cases: The system is stable: ROC : 12 z 3 12 n u(n) 2(3)n u(n 1) The system is causal: ROC : z 3 h( n) h( n) 12 n u(n) 2(3)n u(n) The system is anti-causal: ROC : z 0.5 h(n) [ 12 n 2(3)n ]u(n 1) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 60 Discussed z-transform, region of convergence, properties of z-transform and how the inverse ztransform can be calculated. Discussed LCCDEs and the concept of the pole-zero for their z-transform Next: we will analyze the properties of ideal filters Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 61