MIT OpenCourseWare http://ocw.mit.edu 2.161 Signal Processing: Continuous and Discrete Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Massachusetts Institute of Technology Department of Mechanical Engineering 2.161 Signal Processing - Continuous and Discrete Fall Term 2008 Lecture 151 Reading: • Proakis & Manolakis, Ch. 7 • Oppenheim, Schafer & Buck. Ch. 10 • Cartinhour, Chs. 6 & 9 1 Frequency Response and Poles and Zeros As we did for the continuous case, factor the discrete-time transfer functions into as set of poles and zeros; �M b0 z 0 + b1 z −2 + · · · + bM z −M i=1 (z − zi ) H(z) = = K �N 0 −2 −N a0 z + a1 z + · · · + aN z i=1 (z − pi ) where Zi are the system zeros, the pi are the system poles, and K = b0 /a0 is the overall gain. We note, as in the continuous case that the polse and zeros must be either real, or appear in complex conjugate pairs. As in the continuous case, we can draw a set of vectors from the poles and zeros to a test point in the z-plane, and evaluate H(z) in terms of the lengths and angles of these vectors. In particular, we choose to evaluate H( ej ω ) on the unit circle, � �M � j ω − zi i=1 e jω H( e ) = K �N jω − p ) i i=1 ( e and � �M � j ω �M � e − zi � � � i=1 qi �H( ej ω )� = K �i=1 = K �N N jω − p | i i=1 | e i=1 ri M N M N � � � � � � jω � � jω � H( ej ω ) = � � e − zi − e − pi = θi − φi i=1 i=1 i=1 i=1 where the qi and θi are the lengths and angles of the vectors from the zeros to the point z = ej ω , the ri and φi are the lengths and angles of the vectors from the poles to the point z = ej ω , as shown below: 1 c D.Rowell 2008 copyright � 15–1 Á {z } j1 p -1 O z 1 X f q 1 q r2 1 1 X p 1 f z = r1 q r3 X p f 3 3 A t fre q u e n c y w : e jw |H ( e jw ) | = K H ( e jw ) = ( q O 2 z q 2 2 q 1 q 2 r1 r2 r3 + q 2 ) 1 - (f 1 + f 2 + f 3 )  {z } 1 2 2 - j1 We can interpret the effect of pole and zero locations on the frequency response as follows: � � (a) A pole (or conjugate pole pair) on the unit circle will cause �H( ej ω )� to become infinite at frequency ω. � � (b) A zero (or conjugate zero pair) on the unit circle will cause �H( ej ω )� to become zero at frequency ω. � � (c) Poles near the unit circle will cause a peak in �H( ej ω )� in the neighborhood of those poles. � � (c) Zeros near the unit circle will cause a dip, or notch, in �H( ej ω )� in the neighborhood of those zeros. � � (d) Poles and zeros at the origin z = 0 have no effect upon �H( ej ω )�, but add a frequency dependent linear phase taper (−ω for a pole, +ω for a zero), which is equivalent to shift. � � (e) A pole or zero at z = 1 forces �H( ej ω )� to be infinite (pole) or 0 (zero) at ω = 0. � � (f ) A pole or zero at z = −1 forces �H( ej ω )� to be infinite (pole) or 0 (zero) at ω = π, (the Nyquist frequency). 2 FIR Low-Pass Filter Design The FIR (finite impulse response) filter is an all-zero system with a difference equation yn = M � bk fn−k k=0 which is clearly a convolution of the input sequence with an impulse response {hk } = {bk }, for k = 0, · · · , M . A direct-form causal implementation is 15–2 fn z b fn -1 b -1 0 + z f -1 n -2 b 1 + + z fn -1 b -3 2 + z -M b 3 + + fn -1 + + M y n The transfer function is H(z) = M � bk z −k = k=0 M 1 � bk z M −k z M k=0 and the frequency response is jω H( e ) = M � bk e−j kω . k=0 Note that there are M + 1 terms in the impulse response but the order of the polynomials is M . Example 1 Find the frequency response H( ej ω ) for a simple three-point moving average filter: 1 yn = (fn + fn−1 + fn−2 ) . 3 Solution: 1 1 1 H(z) = z 0 + z −1 + z −2 3 3 3 so that � 1� 1 + e−j ω + e−2j ω 3 � 1 −j ω � −j ω = e e + 1 + ej ω 3 1 = (1 + 2 cos(ω)) e−j ω 3 H( ej ω ) = and � � �H( ej ω )� = 1 (1 + 2 cos(ω)) 3 � H( ej ω ) = −ω. 15–3 |H (e jw )| p 0 - p w The ideal FIR low-pass filter has a response � 1 |ω| ≤ ωc jω H( e ) = 0 ωc < |ω| ≤ π |H (e jw )| H (e jw ) = 0 Á {z } H (e 1 w - w - p - w c w c p c c jw ) = 1  {z } w The impulse response hn = Z −1 {H(z)}, and although we are not given H(z) explicitly, we can use the formal definition of the inverse z-transform (Lecture 14) as a contour integral in the z-plane, � ∞ 1 −1 H(z)z n−1 dz Z {H(z)} = 2πj −∞ where the path is a ccw contour enclosing all of the poles of H(z), and for a stable filter choose the contour as the unit-circle. Let z = ej ω , so that dz = j ej ω dω, and � � � ωc ωc sin(ωc n) 1 −1 j nω hn = Z {H(z)} = 1. e dω = 2π −ωc π ωc n The impulse response of the FIR ideal low-pass filter is therefore � � ωc sin(ωc n) hn = π ωc n 15–4 The following figure shows the central region of the impulse response of an ideal FIR filter with ωc = 0.2π: h n 0 .2 0 n It is obvious that this impulse response has two problems: (a) It is infinite in extent, and (b) It is non-causal. To produce a causal, finite length filter (a) Truncate {hn } to include M +1 central points (M +1 odd), that is select the points −M/2 ≤ n ≤ M/2. Let this truncated filter be designated Ĥ(z). (b) Shift the truncated impulse response {ĥn } to the right by M/2 to form a causal sequence {hn }, where hn = ĥ(M/2−n) , for n = 0, . . . M . Take {hn } as the FIR causal approximation to the ideal low-pass filter. Then H (z) = z (M −1)/2 Ĥ(z), that is the response is delayed by (M − 1)/2 samples. The frequency response is H ( ej ω ) = ej (M −1)ω/2 Ĥ( ej ω ), and because Ĥ( ej ω ) is real � � � jω � �H ( e )� = ��Ĥ( ej ω )�� H ( ej ω ) = (M − 1)ω/2. 15–5 Example 2 Design a five point causal FIR low-pass filter with a cut-off frequency ωc = 0.4π. Solution: The ideal filter has an impulse response � � � � ωc sin(ωc n) 1 sin(πn/2) hn = = π ωc n 2 πn/2 Select M + 1 = 5, and select the five central components: n: −2 −1 0 1 2 hn : 0.0935 0.3027 0.4 0.3027 0.0935 Shift to the right by M/2 = 2, and form the causal impulse response {ĥn }: 0 1 2 3 4 n: ĥn : 0.0935 0.3027 0.4 0.3027 0.0935 with difference equation yn = 0.0935fn + 0.3027fn−1 + 0.4fn−2 + 0.3027fn−3 + 0.0935fn−4 The causal impulse response and the frequency response magnitude are shown below: h 0 .4 n | H ( e jw ) | 1 .2 1 0 .3 0 2 7 0 .8 0 .6 0 .4 0 .0 9 3 5 -4 2.1 -2 0 0 .2 2 4 6 8 n 0 0 .5 1 1 .5 2 2 .5 3 w The Effect of Truncation and Shifting (a) The Effect of Truncation The selection of the M + 1 central components of the non-causal impulse response {hn } can be written as a product {hn } = {hn rn } where {rn } is an even rectangular window function � 1 |n| ≤ M/2 rn = 0 otherwise. The following figure shows {rn } for M = 20. 15–6 n 1 -1 0 0 1 0 n The truncated frequency response is therefore 1 H( ej ω ) ⊗ R( ej ω ). 2π H ( ej ω ) = For the window function R(z) = M/2 � z −1 k=−M/2 jω R( e ) = M/2 � e −j kω =1+ M/2 � 2 cos(kω) = DM/2 (ω) k=1 k=−M/2 DM/2 (ω) is known as the Dirichlet kernel, and is found in the study of truncated Fourier series and convolution of periodic functions. It is easy to show (using the sum of a finite geometric series) that R( ej ω ) = DM/2 (ω) = sin((M + 1)ω/2) sin(ω/2) R ( e jw ) M + 1 1 M = 1 0 M = 2 0 M = 3 0 - p 0 15–7 p w Notice (1) The width of the main lobe decreases with M , (2) the side lobes do not decay to zero as ω increases. Aside: The formal definition of the z-transform of the product of two sequences is given by the z-plane contour integral � �z � 1 F (z) = Z {xn yn } = X(ν)Y ν −1 dν ν 2πj where X(z) = Z {xn }, Y (z) = Z {yn }, and the contour lies in the ROC of both X(z) and Y (z). In particular if the unit-circle lies within the ROC of both sequences, choose the unit-circle as the contour, ν = ej ω , then � π 1 j ωo X( ej ω )Y ( ej (ω0 −ω) ) dω F(e ) = 2π −π which is the convolution of X( ej ω ) and Y ( ej ω ). The frequency response of the truncated filter is 1 H( ej ω ) ⊗ R( ej ω ) 2π � π 1 H( ej ν )R( ej (ν−ω) ) dν = 2π −π H ( ej ω ) = or 1 H (e ) = 2π jω � ωc −ωc DM/2 (ν − ω) dν. which is shown below for filter with ωc = 0.4π and lengths M + 1 = 11, 21, 31, and 41: | H '( e jw )| M = 3 0 1 M = 4 0 M = 1 0 M = 2 0 0 .0 9 1 0 0 .4 p 15–8 p w In general: • The amplitude of the ripple in the pass-band does not decrease with the filter order M . • Similarly, the stop-band attenuation is relatively unaffected by the filter order, and the amplitude of the first side-lobe is 0.091, so that the truncated filter has a stop-band attenuation of -21 dB. • The width of the transition-band decreases with increasing M . (b) The Effect of the Right-Shift to Form a Causal Filter The truncated non-causal impulse response {h� } is even and real, so that H � ( ej ω ) is also real and even, that is � H � ( ej ω ) = 0. The right-shift of h� by M/2 samples to force causality imposes Ĥ(z) = z −M/2 H � (z) and therefore Ĥ( ej ω ) = e−j ωM/2 H � ( ej ω ). The phase response of the filter is � H � ( ej ω ) = −(M/2)ω which is a linear phase taper (lag). The effect of the right-shift on the impulse response of the ideal filter is to impose a phase lag that is proportional to frequency, with a slope of −M/2. 15–9