You are on page 1of 14
192 A/DIGITAL FILTER DESIGN the shape of a given signal within the passband. For example, assume a low- pass filter with frequency response H(e™) given by em, fa] hime + Shine % in — min the second sum gives Letting m = N — ra) ° But AV — me, Nodd N-S N=1 Wet WHI z Figure 4.12 General shapes of impulse response /i(n) that give linear phase for odd and even N. 46 FIR FILTER DESIGN 195 was was He*) = 2, Aine“ + 2, hime“ Combining yields wast = me= 2 wnveo[ ee DY fexo[ ifn 282 2 ilies + exn| -( uv - 1 }} waa1 =, 2ndexp{—j lav ~ 19/2}}cos etn ~ (W — 1/21) age, =a By factoring we are able to separate H(e™) into two parts as follows: wat Hle™) = e972 Y 2h{n)cos{wln —(N - 1)/2]}, Neven (4.41) =o dec pie ee Pie ee ed nea pe Maren -, H(e™) has a linear phase with slope imilar derivation leads to Therefore, if the sum remains pos —(N—1)/2. For N an odd number, merrenan =!) 3 male) For N odd, the slope of —(N — 1)/2 causes a delay in the output of (N — 1)/2, which is an integer number of samples, whereas for N even, the slope causes a noninteger delay. The noninteger delay will cause the values of the sequence to be changed, which, in some cases, may be undesirable. We see from the theorem that linear phase is easily obtainable if we constrain our impulse response to have the symmetry indicated. Procedures for the design of discrete-time filters under this constraint are described in the fol- Jowing sections. One approach is to define catalogs of so-called “'windows”” that can be selected to satisfy a certain set of design specifications. 196 A/DIGITAL FILTER DESIGN 4.6.1 Design of FIR filters Using Windows The easiest way to obtain an FIR filter is to simply truncate the impulse response of an IIR filter. If h(n) represents the impulse response of a desired IIR filter, then an FIR filter with impulse response h(n) can be obtained as follows: a fhdn), Msn SN; nO) {i Otherwise (4.43) In general, h(n) can be thought of as being formed by the product of h(n) and “window function," w(n), as follows: hn) = hein) w(n) (4.44) For the h(n) of (4.43), w(n) is said to be a rectangular window and is given by _[ Msnsn, wo) {0 otherwise If we let H(e™), HAe™), and W(e™) represent the Fourier transforms of h(n), hn), and w(n), respectively, the frequency response H(e) of the resulting filter is the convolution of H{e™) and W(e™) given by Hle*) = x f Hde™ We") 0 = H{e™)*Wle*) (4.45) For example, if H{e™) represents an ideal low-pass filter with cutoff frequency ‘@p and w(n) is a rectangular window positioned about the origin, the H(e!) is as shown in Fig. 4.13. Therefore, it is seen that the convolution produces a smeared version of the ideal low-pass frequency response H.{e™). In general, the wider the main ~) wel) me ch ~ hy. aaa m ete ~ = ¥ Figure 4.13 Frequency response obtained by rectangularly windowing ideal low-pass impulse response. ale 46 FIR FILTER DESIGN 197 lobe of Wie”), the more spreading, whereas the narrower the main lobe (larger N), the closer |H(e™)| comes to |H Ae™) In general, we are left with a trade-off of making N large enough so that ‘smearing is minimized, yet small enough to allow reasonable implementation Much work has been done on adjusting w(n) to satisfy certain main lobe and side lobe requirements. Some of the most commonly used windows are the rectangular, Bartlet, Hanning, Hamming, Blackman, and Kaiser windows. These are defined mathematically as follows: Rectangular: wan={e Sanen-! 46 Bartlett: 2n/(N ~ 1), O=nswN- 1/2 wg(n) = 42 — 2n/(N (N-1)/2Sn5N-1 (4.47) 0 elsewhere Hanning. walt) = { ~ cos |2mn/(N - 1)]}/2, OSm5N-1 aan Hamming: ele) = {0 ~0.46cos[2an/(N-1)}, OSMSN-1 4 yo) Blackman { 42 - 0.5008 [2nn/(N - 1)] wadn) + 0.08 cos [4mn/(N — 1). OsasN-1 (4.50) 0, elsewhere ser: wen) = asp where [e2) is the modified zero order Bessel function of the first kind given by Ufa) = SR expla cos @) d8/(22). Except for the rectangular window, the windows exhibit a symmetrical ‘tapering away from the center. Plots of the windows and their Fourier transform ‘magnitudes (in decibels) are shown in Fig. 4.14 for an N = $1. An excellent TIME DOMAIN FREQUENCY DOMAIN Nest Normalized 4, Actual 048 p+ ++ aes o8 (me. wv’ “Transform of rectangular window ous 27.96.48 -20 -40 -0 ‘Transform of Bartlett window ous uy, so» Ou + - 28.65 dB sian”) vo. -0 -40 43 dB Tall Mn by 60 } at ° * ° ‘Transform of Hamming window « bo -20 “0 Waa ao pane 3 3 at By ate econ mail clsass Figure 4.14 Plots of windows in the time domain and 20 log magnitude of their Fourier tranforms in the frequency domain. Reproduced with modifications from Harris, Frederic 1 Sem the Hen af Windewe for Harmonic Anal sith the Disceate Eousiae Testes 4.6 FIR FILTER DESIGN 199 study on windows and their properties is given by Harris [7]. Note that the main Jobe width and first side lobe attenuation increase as we proceed down the figure. Design Procedure An ideal low-pass filter with liner phase of slope —a and cutoff «, can be characterized in the frequency domain by wena{em ME, ‘The corresponding impulse response h(n) can be obtained by taking the inverse Fourier transform of H(e™) and easily shown to be ‘A causal FIR filter with impulse response A(n) can be obtained by multiplying An) by a window beginning at the origin and ending at N — 1 as follows: Ain) = For h(n) to be a linear phase filter, a must be selected so that the resulting h(n) is symmetric. As sin [w,(n — a)]/7(n — a) is symmetric about n = a and the window symmetric about n = (N — 1)/2, a linear phase filter results if the product is symmetric. This requires that a=W-1/2 The frequency responses of low-pass filters with cutoff w, equals 7/2 formed in this way using a Hamming window of size N equals 51, 101, and 201, are shown on the right side of Fig. 4.15. Shown on the left are the nor- malized frequency responses of each of the windows by themselves. Note that the stopband attenuation is approximately 55 dB for N = 101, slightly lower for N = Si, and slightly higher for N = 201. It is also seen that as N is increased, the transition widths of the designed filters are decreased and have approximate widths of 8/N. The 3-dB cutoff frequency is seen to be slightly Jess than the w, of 22/2 and the attenuation is approximately 6 dB at w equals 20 ae (eI 20h ee di 2 == 2 oy -«| = 20 a 20 mee we 2 * 7 2 a -20] 100 20mg 2 wy Const One20 Figure 4.15 Dependence of the Fourier transform of a Hamming window upon window length (a) N= 51 ©) N= 101; (©) N: ‘filter with 46 FIR FILTER DESIGN 201 ‘1/2. Similar trends are observed for the other types of windows allowing us to state the following general properties: 1. The stopband gain for the low-pass filter designed is relatively insen- sitive to the size of the window and the selection of w, depending mainly on the type of window. 2. The transition width of the designed low-pass filter is approximately equal to the main lobe of the window used. These results are summarized quantitatively for the various types of win- dows in Table 4.3. This table although a crude approximation may be used to design an FIR low-pass filter from a given set of digital frequency requirements. If we let Ky, w, and K3, wp represent the cutoff and stopband requirements for the digital filter, an iterative procedure is as follows: Step 1. Select the window type from the table to be the one highest up the list such that the stop band gain exceeds K;, Step 2. Select the number of points in the window to satisfy the tran width for the type of window used. If w, is the transition width, we must have ion ©, = 0, — w= n/N where k depends upon the type of window used. Rearranging the above equation, Nis seen to satisfy NZk-2n/(w; - w,) (4.52) Step 3. Select the i, and a for the impulse response as w= 0, (4.534) a=(V- 1/2 (4.53b) TABLE 4.3 DESIGN TABLE FOR FIR LOW-PASS FILTER DESIGN Minimum Transition stopband width attenuation Reciangular n/N 218 Baier n/N = 2548 Hanning n/N Hamming ae/N Blackman 1a/N Variable 202 A(DIGITAL FILTER DESIGN ‘Thus, a trial filter impulse response is given by sin [w(n — (N ~ 1)/2)) = Malet ON 45 Wn) = wee (4.54) Step 4. Plot the frequency response H(e™) which, for odd N, is as follows: weya Hem) = em {av = 1)/2)+ SD 2(nycos lw{n ~ (N - wan} =o (4.55) and check to see if the given specifications are satisfied. For N even use Eq. (440. Step 5. If the attenuation requirement at w, is not satisfied, adjust w, accordingly, normally larger on the first iteration, and return to Step 4 using Eq, (4.54) with the new w,; otherwise continue Step 6. If the frequency response requirements are satisfied, check to see if a further reduction in N might be possible. If a further reduction in N is not possible, the h(n) found is the desired design. If a reduction in N appears possible, reduce N in Eq. 4.54 and return to Step 4 for verification The overall procedure may be terminated any time a filter is found that satisfies the given digital specifications. This procedure is a tial and error method and performs satisfactorily; however, no claim of optimality can be made. Nor- mally a filter found using this procedure will have a higher N than what could be designed by various computer techniques; however, the method presented is both simple and instructive and provides useful designs. If the filter is to be used in an A/D-H(z)-D/A structure, the set of equiv- alent analog specifications must first be converted to digital specifications before the protedure described above is begun. For analog critical frequencies {2, and ,, the corresponding digital specifications using a sampling rate of 1/T sam- ples/sec are given by or A low-pass FIR filter design using the above described technique is presented in the following example. EXAMPLE 4.7 Design a low-pass digital filter to be used in an A/D-H(2)-D/A structure that will have a —3-dB cutoff of 30m rad/sec and an attenuation of ‘46 FIR FILTER DESIGN 203 SO dB at 4S rad/sec. The filter is required to have linear phase and the system will use a sampling rate of 100 samples/sec. Solution. The desired equivalent analog frequency response is shown in Fig. 4.16 and the digital specifications obtained are as follows: = 2,:T = 30(0.01) =0.3nrad, — K,2 -3dB ,-T = 45n(0.01) = 0.45erad, K, 5 -50dB 1. To obtain a stopband attenuation of ~ 50 dB or more, a Hamming, Blackman, or Kaiser window could be used. The Hamming window is chosen since it has the smallest transition band thus giving the small- est N. 2. The approximate number of points needed to satisfy the transition band requirement can be found for w, = 0.30n and w; = 0.45m using the Hamming window (k = 4) to be N2k-2n/(w, — w,) = 4-22/(0.4Se — 0.3n) = 53.3 To obtain an integer delay the next odd number (N = 55) is selected. 3. From Eq. (4.53), w, and a are selected as follows: ©, = 0, = 03" a=(N-1/2=27 thus giving a trial impulse response h(n) for a Hamming window as 0,54 - 0.46c0s(2nn/S4)], Ons 54 20 108 1Alyg (1 Figure 4.16 Desired frequency response for Example 4.7; (a) digital frequency re- sponse: (b) equivalent analog frequency response. (4B)4 20 10g 1HCe"*)1 ln 03r 045" ro ® (6B) 4 20 tog LHe!) Gls 032 O4se ro o Figure 4.17 Magnitude of the frequency response for the FIR filter designed for Ex- ample 4.7; (a) initial design, (b) improved design.

You might also like