Lecture 8 - FIR Filter Design include all of the following content: FIR filter design, commonly used windows, generalized linear-phase FIR filter, the Kaiser window filter design method.
Digital Signal Processing, Fall 2006 Lecture 8: FIR Filter Design Zheng-Hua Tan Department of Electronic Systems Aalborg University, Denmark zt@kom.aau.dk Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Course at a glance MM1 Discrete-time signals and systems MM2 Fourier-domain representation Sampling and reconstruction MM4 z-transform MM3 DFT/FFT System System analysis System structure MM6 MM5 Filter design MM7, MM8 MM9, MM10 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 FIR filter design Design problem: the FIR system function M H ( z ) = ∑ bk z − k k =0 0≤n≤M ⎧b , h[n] = ⎨ n otherwise ⎩0, Start from impulse response directly H ( z ) = h[0] + h[1]z −1 + + h[ M ]z − M Find the degree M and the filter coefficients h[k] to approximate a desired frequency response Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Part I: FIR filter design FIR filter design Commonly used windows Generalized linear-phase FIR filter The Kaiser window filter design method Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Lowpass filter – as an example ⎧1, | ω |< ωc H lp (e jω ) = ⎨ ⎩0, ωc < ω ≤ π sin ωc n h[n] = , −∞ < n < ∞ πn Ideal lowpass filter IIR filter: based on transformations of continuoustime IIR system into discrete-time ones | H c ( jΩ ) | = 1 + (Ω / Ω c ) N poles FIR filter: how? h[n] is non-causal, infinite! Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design by windowing Desired frequency responses are often piecewiseconstant with discontinuities at the boundaries between bands, resulting in non-causal and infinte impulse response extending from − ∞ to ∞, but n → ±∞, hd [n] → So, the most straightforward method is to truncate the ideal response by windowing and timeshifting: ⎧h [n], | n |≤ M g[ n ] = ⎨ d ⎩0, otherwise h[n] = g[n − M ] Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design by windowing After Champagne & Labeau, DSP Class Notes 2002 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design by rectangular window In general, h[n] = hd [n]w[n] For simple truncation, the window is the rectangular window ⎧1, ≤ n ≤ M w[n] = ⎨ ⎩0, otherwise H ( e jω ) = 2π π ∫πH − d (e jθ ) H (e j (ω −θ ) )dθ Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Convolution process by truncation Fig 7.19 w[n] = 1, − ∞ < n < ∞, then what ? W ( e jω ) = ∞ ∑ 2πδ (ω + 2πr ) r = −∞ jω Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 W (e ) should be narrow band Requirements on the window w[n] = 1, − ∞ < n < ∞, W ( e jω ) = ∞ ∑ 2πδ (ω + 2πr ) r = −∞ W (e jω ) should be narrow band Requirements W (e jω ) approximates an impulse to faithfully reproduce the desired frequency response w[n] as short as possible in duration (the order of the filter) to minimize computation in the implementation of the filter Ỉ Conflicting Take the rectangular window as an example 10 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Rectangular window M+1 M=7 constant 4π 11 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Part II: Commonly used windows 12 FIR filter design Commonly used windows Generalized linear-phase FIR filter The Kaiser window filter design method Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Standard windows – time domain Rectangular w[n] = ⎧⎨1, ≤ n ≤ M ⎩0, otherwise ⎧2 n / M , ≤ n ≤ M / Triangular ⎪ w[n] = ⎨2 − 2n / M , M / ≤ n ≤ M ⎪0, otherwise ⎩ Hanning ⎧0.5 − 0.5 cos(2πn / M ), ≤ n ≤ M w[n] = ⎨ otherwise ⎩0, Hamming ⎧0.54 − 0.46 cos(2πn / M ), ≤ n ≤ M w[n] = ⎨ otherwise ⎩0, Blackman ⎧0.42 − 0.5 cos(2πn / M ) + 0.08 cos(4πn / M ), ≤ n ≤ M w[n] = ⎨ 13 0, Signal Processing, VIII, Zheng-Hua Tan, 2006 otherwise ⎩Digital Standard windows – figure Fig 7.21 Plotted for convenience In fact, the window is defined only at integer values of n 14 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Standard windows – magnitude 15 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Standard windows – comparison Magnitude of side lobes vs width of main lobe Independent of M! 16 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Part III: Linear-phase FIR filter FIR filter design Commonly used windows Generalized linear-phase FIR filter The Kaiser window filter design method 17 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Linear-phase FIR systems Generalized linear-phase system H (e jω ) = A(e jω )e − jωα + jβ A(e jω ) is a real function of ω , α and β are real constants Causal FIR systems have generalized linear-phase if h[n] satisfies the symmetry condition h[ M − n] = h[n], n = 0,1, , M or h[ M − n] = −h[n], n = 0,1, , M 18 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Types of GLP FIR filters h[ M − n] = εh[n], n = 0,1, , M ε = or − 19 M even M odd ε =1 Type I Type II ε = −1 Type III Type IV Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Generalized linear phase FIR filter Often aim at designing causal systems with a generalized linear phase (stability is not a problem) If the impulse response of the desired filter is symmetric about M/2, hd [ M − n] = hd [n] Choose windows being symmetric about the point M/2 ⎧w[ M − n], ≤ n ≤ M w[n] = ⎨ ⎩0, otherwise W (e jω ) = We (e jω )e − jωM / We (e jω ) is a real, even function of w Ỉ the resulting frequency response will have a generalized linear phase H (e jω ) = Ae (e jω )e − jωM / 20 Ae (e jω ) is real and even Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 10 Linear-phase lowpass filter – an example Desired frequency response ⎧e − jωM / , | ω |< ωc H lp (e jω ) = ⎨ ωc < ω ≤ π ⎩0, sin[ωc (n − M / 2)] hlp [n] = , −∞ < n < ∞ π (n − M / 2) so hlp [ M − n] = hlp [n] apply a symmetric window Ỉ a linear-phase system h[n] = hlp [n]w[n] = 21 sin[ωc (n − M / 2)] w[n] π (n − M / 2) Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Window method approximations H d (e jω ) = H e (e jω )e − jωM / H e (e jω ) is real and even W (e jω ) = We (e jω )e − jωM / We (e jω ) is real and even H (e jω ) = Ae (e jω )e − jωM / Ae (e jω ) = 22 2π π ∫−π H e (e jθ )We (e j (ω −θ ) )dθ Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 11 Key parameters To meet the requirement of FIR filter, choose 23 Shape of the window Duration of the window Trail and error is not a satisfactory method to design filters Æ a simple formalization of the window method by Kaiser Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Part IV: Kaiser window filter design 24 FIR filter design Commonly used windows Generalized linear-phase FIR filter The Kaiser window filter design method Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 12 The Kaiser window filter design method An easy way to find the trade-off between the mainlobe width and side-lobe area The Kaiser window ⎧ I [ β (1 − [(n − α ) / α ]2 )1 / ] , 0≤n≤M ⎪ w[n] = ⎨ I (β ) ⎪0, otherwise ⎩ α = M /2 25 I (⋅) is the zeroth-order modified Bessel function of the first kind β ≥ is an adjustable design parameter The length (M+1) and the shape parameter β can be adjusted to trade side-lobe amplitude for main-lobe width (not possible for preceding windows!) Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 The Kaiser window 26 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 13 Design FIR filter by the Kaiser window Calculate M and β to meet the filter specification The peak approximation error δ is determined by β (Peak error is fixed for other windows) Define A = −20 log10 δ then A > 50 ⎧0.1102( A − 8.7), ⎪ 0.4 β = ⎨0.5842(A - 21) + 0.07886( A − 21), 21 ≤ A ≤ 50 ⎪0.0, (Rectangular) A < 21 ⎩ 27 Passband cutoff frequency ω p is determined by: | H (e jω ) |≥ − δ jω Stopband cutoff frequency ω s by: | H (e ) |≤ δ Transition width Δω = ω s − ω p M must satisfy A−8 M = 2.285Δω Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 A lowpass filter Specifications Specifications for a discrete-time lowpass filter − 0.01 ≤| H (e jω ) |≤ + 0.01, ≤ ω ≤ ω p = 0.4π | H (e jω ) |≤ 0.001, ω ≥ ω s = 0.6π δ = 0.01 δ = 0.001 28 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 14 Design the lowpass filter by Kaiser window Designing by window method indicating δ = δ , we must set δ = 0.001 Transition width Δω = ω s − ω p = 0.2π A = −20 log10 δ = 60 M = 37 The two parameters: β = 5.653, Cutoff frequency of the ideal lowpass filter ω c = (ω s + ω p ) / = 0.5π Impulse response ⎧ sin ωc (n − α ) I [ β (1 − [(n − α ) / α ]2 )1 / ] ⋅ , 0≤n≤M ⎪ h[n] = ⎨ π (n − α ) I (β ) ⎪0, otherwise ⎩ 29 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design the lowpass filter What is the group delay? M/2=18.5 30 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 15 Summary 31 FIR filter design Commonly used windows Generalized linear-phase FIR filter The Kaiser window filter design method Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Course at a glance MM1 Discrete-time signals and systems MM2 Fourier-domain representation Sampling and reconstruction MM4 z-transform MM3 32 DFT/FFT System System analysis System structure MM6 MM5 Filter design MM7, MM8 MM9, MM10 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 16 ... Take the rectangular window as an example 10 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Rectangular window M+1 M=7 constant 4π 11 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006... at integer values of n 14 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Standard windows – magnitude 15 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Standard windows – comparison... Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design by windowing After Champagne & Labeau, DSP Class Notes 2002 Digital Signal Processing, VIII, Zheng-Hua Tan, 2006 Design by rectangular