550 likes | 570 Views
Chapter 10. FIR Digital Filter Design. Basic approaches to FIR digital filter design. Unlike IIR digital filter design, FIR filter design does not have any connection with the design of analog filters.
E N D
Chapter 10 FIR Digital Filter Design
Basic approaches to FIR digital filter design • Unlike IIR digital filter design, FIR filter design does not have any connection with the design of analog filters. • The design of FIR filters is based on a direct approximation of the specified magnitude response, with often added requirement that the phase response be linear.
FIR filter design based on Windowed Fourier series • The real-coefficient FIR filters are described by a transfer function that is a polynomial in z-1 and therefore require different approaches for their design. • A direct and straightforward method is based on truncation the Fourier series representation of the prescribed frequency response • The second method is based on the observation that for a length (N+1) FIR filter, and the impulse response sequence can be readily computed by applying an inverse DFT to the frequency samples.
Least Integral-Squared Error Design of FIR Filters • Let Hd(ejω) denote the desired frequency response • Since Hd(ejω) is a periodic function of ω with a period 2π, it can be expressed as a Fourier series where
Least Integral-Squared Error Design of FIR Filters • In general, Hd(ejω) is piecewise constant with sharp transitions between bands • In which case, {hd[n]} is of infinite length and noncausal • Objective - Find a finite-duration {ht[n]} of length 2M+1 whose DTFT Ht(ejω) approximates the desired DTFT Hd(ejω) in some sense
Least Integral-Squared Error Design of FIR Filters • Commonly used approximation criterion Minimize the integral-squared error where
Best finite-length approximation to ideal infinite-length impulse response in the mean-square sense is obtained by truncation Least Integral-Squared Error Design of FIR Filters • Using Parseval’s relation we can write • It follows from the above that φ is minimum when ht[n]=hd[n] for -M≤n≤M
Least Integral-Squared Error Design of FIR Filters • A causal FIR filter with an impulse response h[n] can be derived from ht[n] by delaying: • The causal FIR filter h[n] has the same magnitude response as ht[n] and its phase response has a linear phase shift of ωM radians with respect to that of ht[n]
Impulse Responses of Ideal Filters • Ideal lowpass filter - Ideal highpass filter -
Impulse Responses of Ideal Filters • Ideal bandpass filter -
Impulse Responses of Ideal Filters • Ideal bandstop filter -
Impulse Responses of Ideal Filters • Ideal multiband filter -
Impulse Responses of Ideal Filters • Ideal discrete-time Hilbert transformer
Impulse Responses of Ideal Filters • Ideal discrete-time differentiator -
Gibbs Phenomenon • Gibbs phenomenon - Oscillatory behavior in the magnitude responses of causal FIR filters obtained by truncating the impulse response coefficients of ideal filter
Gibbs Phenomenon • As can be seen, as the length of the lowpass filter is increased, the number of ripples in both passband and stopband increases, with a corresponding decrease in the ripple widths • Height of the largest ripples remain the same independent of length • Similar oscillatory behavior observed in the magnitude responses of the truncated versions of other types of ideal filters
where and are the DTFTs of and , respectively Gibbs Phenomenon • Gibbs phenomenon can be explained by treating the truncation operation as an windowing operation: In the frequency domain
Thus is obtained by a periodic continuous convolution of with Gibbs Phenomenon
If is a very narrow pulse centered at (ideally a delta function) compared to variations in , then will approximate very closely • On the other hand, length 2M+1 of should be as small as possible to reduce computational complexity Gibbs Phenomenon • Length 2M+1 of w[n] should be very large
Presence of oscillatory behavior in is basically due to: • 1) is infinitely long and not absolutely summable, and hence filter is unstable Gibbs Phenomenon • A rectangular window is used to achieve simple truncation: • 2) Rectangular window has an abrupt transition to zero
Oscillatory behavior can be explained by examining the DTFT of WR[n] has a main lobe centered at ω=0 Gibbs Phenomenon • Other ripples are called sidelobes
Main lobe of characterized by its width 4π/(2M+1) defined by first zero crossings on both sides of ω=0 • Ripples in around the point of discontinuity occur more closely but with no decrease in amplitude as M increases Gibbs Phenomenon • As M increases, width of main lobe decreases as desired • Area under each lobe remains constant while width of each lobe decreases with an increase in M
Rectangular window has an abrupt transition to zero outside the range • -M≤n≤M , which results in Gibbs phenomenon in Gibbs Phenomenon • Gibbs phenomenon can be reduced either: (1) Using a window that tapers smoothly to zero at each end, or (2) Providing a smooth transition from passband to stopband in the magnitude specifications
Low pass FIR filter design 1. Choose a pass band edge frequency for design that is midway through the transition width. 2. Find the impulse response hL[n] for the ideal low pass filter with this pass band edge frequency. 3. Choose a window w[n] that gives adequate stop band attenuation, and determine the number of terms N needed to give the required transition width. An odd number should be chosen, so that the impulse response will be perfectly symmetrical around its middle point.
Low pass FIR filter design 4. Find the impulse response h[n] = hL[n]w[n] for the FIR filter. 5. Shift the impulse response to the right by (N-1)/2 samples. • The impulse response produced by this design method can be used to create a difference equation for the filter and also a plot of the filter shape.
Low Pass Filter Impulse Response and Shape Impulse Response Shape
After High Pass Filtering (pass band edge 80 Hz) After Low Pass Filtering (pass band edge 40 Hz) After Band Stop Filtering (pass band edges 40 Hz and 80 Hz) After Band Pass Filtering (pass band edges 40 Hz and 80 Hz) Filtering a Voltage Signal
Fixed Window Functions • Using a tapered window causes the height of the sidelobes to diminish, with a corresponding increase in the main lobe width resulting in a wider transition at the discontinuity • Hann: W[n[=0.5+0.5cos[2n/(2M+1)], -Mn M • Hamming: W[n[=0.54+0.46cos[2n/(2M+1)], -Mn M • Blackman: W[n[=0.42+0.5cos[2n/(2M+1)] +0.08cos[4n/(2M+1)]
Hanning Window w[n[=0.5+0.5cos[2n/(2M+1)], -Mn M
Hamming Window w[n[=0.54+0.46cos[2n/(2M+1)], -Mn M
Blackman Window w[n[=0.42+0.5cos[2n/(2M+1)] +0.08cos[4n/(2M+1)]
Rectangular window Hanning window 0 0 -20 -20 -40 Gain, dB Gain, dB -40 -60 -60 -80 -80 -100 -100 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 w p / w p / Hamming window Blackman window 0 0 -20 -20 -40 -40 Gain, dB Gain, dB -60 -60 -80 -80 -100 -100 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 w p w p / / Fixed Window Functions • Plots of magnitudes of the DTFTs of these windows for M = 25 are shown below
Fixed Window Functions • Magnitude spectrum of each window characterized by a main lobe centered at w = 0 followed by a series of sidelobes with decreasing amplitudes • Parameters predicting the performance of a window in filter design are: • Main lobe width • Relative sidelobe level
Fixed Window Functions • Main lobe width ML- given by the distance between zero crossings on both sides of main lobe • Relative sidelobe level Asl - given by the difference in dB between amplitudes of largest sidelobe and main lobe
Fixed Window Functions Observe Thus, • Passband and stopband ripples are the same
Fixed Window Functions • Distance between the locations of the maximum passband deviation and minimum stopband value ML • Width of transition band w = s - p < ML
Fixed Window Functions • To ensure a fast transition from passband to stopband, window should have a very small main lobe width • To reduce the passband and stopband ripple d, the area under the sidelobes should be very small • Unfortunately, these two requirements are contradictory
Fixed Window Functions • In the case of rectangular, Hann, Hamming, and Blackman windows, the value of ripple does not depend on filter length or cutoff frequency c , and is essentially constant • In addition, w c / M where c is a constant for most practical purposes
Fixed Window Functions Properties of some fixed window functions
Design Steps for Windowed Low Pass FIR Filters • Choose a pass band edge frequency in Hz for the filter in the middle of the transition width: fc=(fp+ fs)/2 (2) Calculate Ωc= 2πfc/fT and substitute into h1[n], the infinite impulse response for an ideal low pass filter: h1[n]=sin(nΩc)/nπ (3) Choose a window based on the specified, and calculate the number of nonzero window terms • Calculate FIR h[n] from h[n]=h1[n]w[n], notice the response is noncausal. • Shift the impulse response to the right by (N-1)/2 to make the filter causal
FIR Filter Design Example • An increase in the main lobe width is associated with an increase in the width of the transition band • A decrease in the sidelobe amplitude results in an increase in the stopband attenuation
FIR Filter Design Example • Specifications: ωp=0.3π, ωs=0.5π , αs=40dB Thus Choose N = 24 implying M =12
Hence where w[n] is the n-th coefficient of a length-25 Kaiser window with β=3.3953 FIR Filter Design Example
FIR Filter Design Example 1 • The specifications of a low pass filter: Pass band edge 2kHz Stop band edge 3kHz Stop band attenuation 40dB Sampling frequency 10kHz
FIR Filter Design Example 1 • Transition width = 3 – 2 = 1 kHz • f1= 2000+1000/2=2500Hz • Ω1=2πf1/fT=2π2500/10000=0.5π • h1[n]=sin(nΩ1)/nπ=sin(0.5πn)/nπ • Choose Hanning window, with • N=3.32fT/T.W.=33.2, choose N=33 • w[n]=0.5+0.5cos(2πn/32) *T.W. Transition Width
Impulse Response frequency Response FIR Filter Design Example 1 • G(jωp)=-0.06 dB at ωp=2.013 kHz • G(jωs)=-40 dB atωs =2.976 kHz