Finite Impulse Response Filters

54 359 0
Finite Impulse Response Filters

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

CHAPTER Finite Impulse Response Filters 5.1 INTRODUCTION From the previous two chapters, we have become familiar with the magnitude response of ideal lowpass, highpass, bandpass, and bandstop filters, which was approximated by IIR filters In the previous chapter, we also discussed the theory and a few prominent procedures for designing the IIR filters The general form of the difference equation for a linear, time-invariant, discrete-time system (LTIDT system) is y(n) = − N a(k)y(n − k) + k=1 M b(k)x(n − k) (5.1) k=0 The transfer function for such a system is given by H (z−1 ) = b0 + b(1)z−1 + b(2)z−2 + · · · + b(M)z−M + a(1)z−1 + a(2)z−2 + a(3)z−3 + · · · + a(N )z−N (5.2) The transfer function of an FIR filter, in particular, is given by H (z−1 ) = b0 + b(1)z−1 + b(2)z−2 + · · · + b(M)z−M (5.3) and the difference equation describing this FIR filter is given by y(n) = M b(k)x(n − k) (5.4) k=0 = b(0)x(n) + b(1)x(n − 1) + · · · + b(M)x(n − M) (5.5) In this chapter, the properties of the FIR filters and their design will be discussed When the input function x(n) is the unit sample function δ(n), the Introduction to Digital Signal Processing and Filter Design, by B A Shenoi Copyright © 2006 John Wiley & Sons, Inc 249 250 FINITE IMPULSE RESPONSE FILTERS output y(n) can be obtained by applying the recursive algorithm on (5.4) We get the output y(n) due to the unit sample input δ(n) to be exactly the values b(0), b(1), b(2), b(3), , b(M) The output due to the unit sample function δ(n) is the unit sample response or the unit impulse response denoted by h(n) So the samples of the unit impulse response h(n) = b(n), which means that the unit impulse response h(n) of the discrete-time system described by the difference equation (5.4) is finite in length That is why the system is called the finite impulse response filter or the FIR filter It has also been known by other names such as the transversal filter, nonrecursive filter, moving-average filter, and tapped delay filter Since h(n) = b(n) in the case of an FIR filter, we can represent (5.3) in the following form: H (z−1 ) = M h(k)z−k = h(0) + h(1)z−1 + h(2)z−2 + · · · + h(M)z−(M) (5.6) k=0 The FIR filters have a few advantages over the IIR filters as defined by (5.1): We can easily design the FIR filter to meet the required magnitude response in such a way that it achieves a constant group delay Group delay is defined as τ = −(dθ/dω), where θ is the phase response of the filter The phase response of a filter with a constant group delay is therefore a linear function of frequency It transmits all frequencies with the same amount of delay, which means that there will not be any phase distortion and the input signal will be delayed by a constant when it is transmitted to the output A filter with a constant group delay is highly desirable in the transmission of digital signals The samples of its unit impulse response are the same as the coefficients of the transfer function as seen from (5.5) and (5.6) There is no need to calculate h(n) from H (z−1 ), such as during every stage of the iterative optimization procedure or for designing the structures (circuits) from H (z−1 ) The FIR filters are always stable and are free from limit cycles that arise as a result of finite wordlength representation of multiplier constants and signal values The effect of finite wordlength on the specified frequency response or the time-domain response or the output noise is smaller than that for IIR filters Although the unit impulse response h(n) of an IIR filter is an infinitely long sequence, it is reasonable to assume in most practical cases that the value of the samples becomes almost negligible after a finite number; thus, choosing a sequence of finite length for the discrete-time signal allows us to use powerful numerical methods for processing signals of finite length 5.1.1 Notations It is to be remembered that in this chapterwe choose the order of the FIR −n filter or degree of the polynomial H (z−1 ) = N as N , and the length n=0 h(n)z LINEAR PHASE FIR FILTERS 251 of the filter equal to the number of coefficients in (5.6) is N + If we are given H (z−1 ) = 0.3z−4 + 0.1z−5 + 0.5z−6 , its order is 6, although only three terms are present and the correct number of coefficients equal to the length of the filter is 7, because h(0) = h(1) = h(2) = h(3) = It becomes necessary to point out the notation in this chapter, because in some textbooks, we may N −1 used −n −1 find H (z ) = n=0 h(n)z representing the transfer function of an FIR filter, in which case the length of the filter is denoted by N and the degree or order of the polynomial is (N − 1) (Therefore students have to be careful in using the formulas found in a chapter on FIR filters, in different books; but with some caution, they can replace N that appears in this chapter by (N − 1) so that the formulas match those found in these books.) The notation often used in MATLAB, is H (z−1 ) = h(1) + h(2)z−1 + h(3)z−2 + · · · + h(N + 1)z−N , which is a polynomial of degree N , and has (N + 1) coefficients In more compact form, it is given by H (z−1 ) = N h(n + 1)z−n (5.7) n=0 The notation and meaning of angular frequency used in the literature on discretetime systems and digital signal processing also have to be clearly understood by the students One is familiar with a sinusoidal signal x(t) = A sin(wt) in which w = 2πf is the angular frequency in radians per second, f is the frequency in hertz, and its reciprocal is the period Tp in seconds So we have w = 2π/Tp radians per second Now if we sample this signal with a uniform sampling period, we need to differentiate the period Tp from the sampling period denoted by Ts Therefore, the sampled sequence is given by x(nTs ) = A sin(wnTs ) = A sin(2πnTs /Tp ) = A sin(2πf/fs ) = A sin(w/fs ) The frequency w (in radians per second) normalized by fs is almost always denoted by ω and is called the normalized frequency (measured in radians) The frequency w is the analog frequency variable, and the frequency ω is the normalized digital frequency On this basis, the sampling frequency ωs = 2π radians Sometimes, w is normalized by πfs or 2πfs so that the corresponding sampling frequency becomes or radian(s) Note that almost always, the sampling period is denoted simply by T in the literature on digital signal processing when there is no ambiguity and the normalized frequency is denoted by ω = wT The difference between the angular frequency in radians per second and the normalized frequency usually used in DSP literature has been pointed out in several instances in this book 5.2 LINEAR PHASE FIR FILTERS Now we consider the special types of FIR filters in which the coefficients h(n) −n of the transfer function H (z−1 ) = N are assumed to be symmetric n=0 h(n)z or antisymmetric Since the order of the polynomial in each of these two types 252 FINITE IMPULSE RESPONSE FILTERS can be either odd or even, we have four types of filters with different properties, which we describe below Type I The coefficients are symmetric [i.e., h(n) = h(N − n)], and the order N is even Example 5.1 Let us consider a simple example: H (z−1 ) = h(0) + h(1)z−1 + h(2)z−2 + h(3)z−1 + h(4)z−4 + h(5)z−5 + h(6)z−6 As shown in Figure 5.1a, for this type I filter, with N = 6, we see that h(0) = h(6), h(1) = h(5), h(2) = h(4) Using these equivalences in the above, we get H (z−1 ) = h(0)[1 + z−6 ] + h(1)[z−1 + z−5 ] + h(2)[z−2 + z−4 ] + h(3)z−3 (5.8) This can also be represented in the form   H (z−1 ) = z−3 h(0)[z3 + z−3 ] + h(1)[z2 + z−2 ] + h(2)[z + z−1 ] + h(3) (5.9) h(n) h(n) 6 7 Center of symmetry Type I N = Type II N = (a) (b) h(n) h(n) Center of antisymmetry Figure 5.1 Type III N = Type IV N = (c) (d ) Unit impulse responses of the four types of linear phase FIR filters LINEAR PHASE FIR FILTERS 253 Let us evaluate its frequency response (DTFT): H (e−j ω ) = e−j 3ω {2h(0) cos(3ω) + 2h(1) cos(2ω) + 2h(2) cos(ω) + h(3)} = ej θ(ω) {HR (ω)} The expression HR (ω) in this equation is a real-valued function, but it can be positive or negative at any particular frequency, so when it changes from a positive value to a negative value, the phase angle changes by π radians (180◦ ) The phase angle θ (ω) = −3ω is a linear function of ω, and the group delay τ is equal to three samples Note that on the normalized frequency basis, the group delay is three samples but actual group delay is 3T seconds, where T is the sampling period In the general case, we can express H (ej ω ) in a few other forms, for example H (ej ω ) = N h(n)e−j nω n=0 = h(0) + h(1)e−j ω + h(2)e−j 2ω + · · · + h(N − 1)e−j (N ω)       Nω N −j [(N/2)ω] 2h(0) cos + 2h(1) cos −1 ω =e 2      N N − ω + ··· + h (5.10) + 2h(2) cos 2 We put it in a more compact form: ⎫ ⎧  N/2  ⎬ ⎨ N  N +2 − n cos(nω) = ej θ(ω) {HR (ω)} h H (ej ω ) = e−j [(N/2)ω] h ⎭ ⎩ 2 n=1 (5.11) The total group delay is a constant = N/2 in the general case, for a type I FIR filter Type II The coefficients are symmetric [i.e., h(n) = h(N − n)], and the order N is odd Example 5.2 Here we consider an example in which the coefficients are symmetric but N = 7, as shown in Figure 5.1b For this example, we have H (z−1 ) = h(0) + h(1)z−1 + h(2)z−2 + h(3)z−1 + h(4)z−4 + h(5)z−5 + h(6)z−6 + h(7)z−7 254 FINITE IMPULSE RESPONSE FILTERS and because of symmetry h(0) = h(7), h(1) = h(6), h(2) = h(5), h(3) = h(4) Therefore H (z−1 ) = h(0)[1 + z−7 ] + h(1)[z−1 + z−6 ] + h(2)[z−2 + z−5 ] + h(3)[z−3 + z−4 ] The frequency response is given by H (e−j ω ) = e−j 3.5ω {2h(0) cos(3.5ω) + 2h(1) cos(2.5ω) + 2h(2) cos(1.5ω) + 2h(3) cos(0.5ω)} = ej θ(ω) {HR (ω)} The phase angle θ (ω) = −3.5ω, and the group delay is τ = 3.5 samples In the general case of type II filter, we obtain H (e−j ω ) = N h(n)e−j nω = ej θ(ω) {HR (ω)} n=0 =e −j ( N2 ω) ⎧ +1)/2 ⎨(N ⎩ n=1 ⎫    ⎬ N +1 − n cos n − ω) (5.12) 2h ⎭ 2  which shows a linear phase θ (ω) = −[(N/2)ω] and a constant group delay = N/2 samples Type III The coefficients are antisymmetric [i.e., h(n) = −h(N − n)], and the order N is even Example 5.3 We consider an example of type III FIR filter of order N = and as shown in Figure 5.1c, we have h(0) = −h(6), h(1) = −h(5), h(2) = −h(4) and we must have h(3) = to maintain antisymmetry for these samples: H (z−1 ) = h(0)[1 − z−6 ] + h(1)[z−1 − z−5 ] + h(2)[z−2 − z−4 ]   = z−3 h(0)[z3 − z−3 ] + h(1)[z2 − z−2 ] + h(2)[z − z−1 ] (5.13) (5.14) LINEAR PHASE FIR FILTERS 255 Now if we put z = ej ω , and ej ω − e−j ω = 2j sin(ω) = 2ej (π/2) sin(ω), we arrive at the frequency response for this filter as H (e−j ω ) = e−j 3ω {h(0)2j sin(3ω) + h(1)2j sin(2ω) + h(2)2j sin(ω)} (5.15) = e−j 3ω ej (π/2) {2h(0) sin(3ω) + 2h(1) sin(2ω) + 2h(2) sin(ω)} (5.16) = e−j [3ω−(π/2)] HR (ω) (5.17) Note that the phase angle for this filter is θ (ω) = −3ω + π/2, which is still a linear function of ω The group delay is τ = samples for this filter In the general case, it can be shown that ⎫ ⎧  N/2  ⎬ ⎨ N H (e−j ω ) = e−j [(Nω−π)/2] − n sin(nω) (5.18) h ⎭ ⎩ n=1 and it has a linear phase θ (ω) = −[(N ω − π)/2] and a group delay τ = N/2 samples Type IV The coefficients are antisymmetric [i.e., h(n) = −h(N − n)], and the order N is odd Example 5.4 We consider an example of type IV filter with N = as shown in Figure 5.1d, in which h(0) = −h(7), h(1) = −h(6), h(2) = −h(5), h(3) = −h(4) Its transfer function is given by H (z−1 ) = h(0)[1 − z−7 ] + h(1)[z−1 − z−6 ] + h(2)[z−2 − z−5 ] + h(3)[z−3 − z−4 ] (5.19) The frequency response can be derived as H (e−j ω ) = e−j 3.5ω {h(0)[ej 3.5ω − e−j 3.5ω ] + h(1)[ej 2.5ω − e−j 2.5ω ] + h(2)[ej 1.5ω − e−j 1.5ω ] + h(3)[ej 0.5ω − e−j 0.5ω ]} = e−j 3.5ω {h(0)2j sin(3.5ω) + h(1)2j sin(2.5ω) + h(2)2j sin(1.5ω) + h(3)2j sin(0.5ω)} = e −j [3.5ω−(π/2)] {2h(0) sin(3.5ω) + 2h(1) sin(2.5ω) + 2h(2) sin(1.5ω) + 2h(3) sin(0.5ω)} (5.20) 256 FINITE IMPULSE RESPONSE FILTERS This type IV filter with N = has a linear phase θ (ω) = −3.5ω + π/2 and a constant group delay τ = 3.5 samples The transfer function of the type IV linear phase filter in general is given by ⎧ ⎫    ⎬ +1)/2  ⎨ (N N +1 H (e−j ω ) = e−j [(Nω−π)/2] − n sin n− ω h ⎩ ⎭ 2 n=1 (5.21) The frequency responses of the four types of FIR filters are summarized below: ⎫ ⎧  N/2  ⎬ ⎨ N  N h +2 − n cos(nω) H (ej ω ) = e−j [(N/2)ω] h ⎭ ⎩ 2 n=1 for type I ⎫    ⎬ (N +1)/2  N + − n cos n− ω h H (e−j ω ) = e−j [(N/2)ω] ⎩ ⎭ 2 ⎧ ⎨ n=1 ⎫ ⎧  N/2  ⎬ ⎨ N − n sin(nω) h H (e−j ω ) = e−j [(Nω−π)/2] ⎭ ⎩ for type II n=1 for type III ⎫    ⎬ (N +1)/2  N +1 − n sin n− ω h H (e−j ω ) = e−j [(Nω−π)/2] ⎩ ⎭ 2 ⎧ ⎨ n=1 for type IV 5.2.1 (5.22) Properties of Linear Phase FIR Filters The four types of FIR filters discussed above have shown us that FIR filters with symmetric or antisymmetric coefficients provide linear phase (or equivalently constant group delay); these coefficients are samples of the unit impulse response It has been shown above that an FIR filter with symmetric or antisymmetric coefficients has a linear phase and therefore a constant group delay The reverse statement, that an FIR filter with a constant group delay must have symmetric or antisymmetric coefficients, has also been proved theoretically [4] These properties are very useful in the design of FIR filters and their applications To see some additional properties of these four types of filters, we have evaluated the magnitude response of typical FIR filters with linear phase They are shown in Figure 5.2 The following observations about these typical magnitude responses will be useful in making proper choices in the early stage of their design, as will be LINEAR PHASE FIR FILTERS Magnitude response of type II FIR filter Magnitude response of type I FIR filter 2.5 Magnitude Magnitude 1.5 0.5 0.5 1.5 0.5 1.5 Normalized frequency Magnitude response of type III FIR filter Magnitude response of type IV FIR filter 3.5 3 2.5 2.5 1.5 2 1.5 0.5 0.5 0 Normalized frequency Magnitude Magnitude 257 0.5 1.5 Normalized frequency Figure 5.2 0 0.5 1.5 Normalized frequency Magnitude responses of the four types of linear phase FIR filters explained later For example, type I filters have a nonzero magnitude at ω = and also a nonzero value at the normalized frequency ω/π = (which corresponds to the Nyquist frequency), whereas type II filters have nonzero magnitude at ω = but a zero value at the Nyquist frequency So it is obvious that these filters are not suitable for designing bandpass and highpass filters, whereas both of them are suitable for lowpass filters The type III filters have zero magnitude at ω = and also at ω/π = 1, so they are suitable for designing bandpass filters but not lowpass and bandstop filters Type IV filters have zero magnitude at ω = and a nonzero magnitude at ω/π = They are not suitable for designing lowpass and bandstop filters but are candidates for bandpass and highpass filters In Figure 5.3a, the phase response of a type I filter is plotted showing the linear relationship When the transfer function has a zero on the unit circle in the z plane, its phase response displays a jump discontinuity of π radians at the corresponding frequency, and the plot uses a jump discontinuity of 2π whenever the phase response exceeds ±π so that the total phase response remains within the principal range of ±π If there are no jump discontinuities of π radians, that is, if there are no zeros on the unit circle, the phase response becomes a 258 FINITE IMPULSE RESPONSE FILTERS Phase response unwrapped −2 Phase angle in radians Phase angle in radians Phase response of type I FIR filter −1 −4 −8 −2 −10 −3 −12 −4 0.5 1.5 −14 0.5 1.5 Normalized frequency Normalized frequency (a) (b) Figure 5.3 Linear phase responses of type I FIR filter continuous function of ω when it is unwrapped The result of unwrapping the phase (Fig 5.3a) is to remove the jump discontinuities in the phase response such that the phase response lies within ±π (Fig 5.3b) If the order N of the FIR filter is even, its group delay is an integer multiple of samples equal to N/2 samples If the order N is odd, then the group delay is equal to (an integer plus half) a sample We will use all of these properties before we start the design of FIR filters with linear phase The linear phase FIR filters have some interesting properties in the z plane also As seen in the examples, their transfer functions always contain pairs of terms such as [zn ± z−n] Denoting the transfer function of the FIR filters with symmetric coefficients by H (z), we write H (z) = N h(n)z −n = n=0 N h(N − n)z−n n=0 By making a change of variable m = (N − n), we reduce the series n)z−n to N h(m)z−N +m = z−N m=0 N h(m)zm = z−N H (z−1 ) (5.23) N n=0 h(N − (5.24) m=0 so we have the following result: H (z) = z−N H (z−1 ) (5.25) ... δ(n) is the unit sample response or the unit impulse response denoted by h(n) So the samples of the unit impulse response h(n) = b(n), which means that the unit impulse response h(n) of the discrete-time... on the unit circle, the phase response becomes a 258 FINITE IMPULSE RESPONSE FILTERS Phase response unwrapped −2 Phase angle in radians Phase angle in radians Phase response of type I FIR filter... frequency response of the product of these two 264 FINITE IMPULSE RESPONSE FILTERS 1.1 1.0 0.9 Hid(w) 0.8 0.7 H(w) 0.6 0.5 0.4 0.3 0.2 0.1 0.0 −0.1 0.2π 0.4π 0.6π π 0.8π Figure 5.6 Frequency response

Ngày đăng: 29/09/2013, 21:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan