1.8k likes | 2.07k Views
Chapter 10. FIR Digital Filter Design. §10.2.1 Least Integral-Squared Error Design of FIR Filters. Let H d (e j ω ) denote the desired frequency response Since H d (e j ω ) is a periodic function of ω with a period 2 π ,it can be expressed as a Fourier series. where.
E N D
Chapter 10 FIR Digital Filter Design
§10.2.1 Least Integral-Squared Error Design of FIR Filters • Let Hd(e jω) denote the desired frequency response • Since Hd(e jω) is a periodic function of ω with a period 2π,it can be expressed as a Fourier series where
§10.2.1 Least Integral-Squared Error Design of FIR Filters • In general Hd(e jω) 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(e jω) approximates the desired DTFT Hd(e jω) insome sence
§10.2.1 Least Integral-Squared Error Design of FIR Filters • Commonly used approximation criterion – Minimize the integral-squared error where
It follows from the above that Φis minimum when ht[n]= hd[n]for-M≤n≤M • Best finite-length approximation to ideal infinite-length impulse response in the mean-square sense is obtained by truncation §10.2.1 Least Integral-Squared Error Design of FIR Filters • Using Parseval’s relation we can write
§10.2.1 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: h[n]=ht[n-M] • The causal FIR filter h[n] has the same magnitude response as ht[n] and its phase response has a linear phase shift of ωMradians with respect to that of ht[n]
§10.2.2 Impulse Responses of Ideal Filters • Ideal lowpass filter – • Ideal highpass filter –
§10.2.2 Impulse Responses of Ideal Filters • Ideal bandpass filter –
§10.2.2 Impulse Responses of Ideal Filters • Ideal bandstop filter –
§10.2.2 Impulse Responses of Ideal Filters • Ideal multiband filter –
§10.2.2 Impulse Responses of Ideal Filters • Ideal discrete-time Hilbert transformer –
§10.2.2 Impulse Responses of Ideal Filters • Ideal discrete-time differentiator –
§10.2.3 Gibbs Phenomenon • Gibbs phenomenon - Oscillatory behavior in the magnitude responses of causal FIR filters obtained by truncating the impulse response coefficients of ideal filters
§10.2.3 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
§10.2.3 Gibbs Phenomenon • Gibbs phenomenon can be explained by treating the truncation operation as an windowing operation: • In the frequency domain whereHt(ejω)and Ψ(ejω) are the DTFTs of ht[n] and w[n] , respectively
§10.2.3 Gibbs Phenomenon • Thus Ht(ejω) is obtained by a periodic continuous convolution of Hd(ejω) with Ψ(ejω)
§10.2.3 Gibbs Phenomenon • If Ψ(ejω) is a very narrow pulse centered at ω=0(ideally a delta function) compared to variations in Hd(ejω) , then Ht(ejω) will approximate Hd(ejω) very closely • Length 2M+1 of w[n] should be very large • On the other hand, length 2M+1 of ht[n] should be as small as possible to reduce computational complexity
§10.2.3 Gibbs Phenomenon • A rectangular windowis used to achieve simple truncation: • Presence of oscillatory behavior in Ht(ejω)is basically due to: – 1) hd[n] nitely long and not absolutely summable, and hence filter is unstable – 2) Rectangular window has an abrupt transition to zero
§10.2.3 Gibbs Phenomenon • Oscillatory behavior can be explained by examining the DTFT ΨR(ejω) of hwR[n]: • R(ejω) has a main lobecentered at ω=0 • Other ripples are called sidelobes
§10.2.3 Gibbs Phenomenon • Main lobe of ΨR(ejω) characterized by its width 4π/(2M+1) defined by first zero crossings on both sides of ω=0 • As Mincreases, width of main lobe decreases as desired • Area under each lobe remains constant while width of each lobe decreases with an increase in M • Ripples in Ht(ejω) around the point of discontinuity occur more closely but with no decrease in amplitude asMincreases
§10.2.3 Gibbs Phenomenon • Rectangular window has an abrupt transition to zero outside the range -M≤n≤M, which results in Gibbs phenomenon in Ht(ejω) • 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
Hann: • Hamming: • Blackman: §10.2.4 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
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 / / §10.2.4 Fixed Window Functions • Plots of magnitudes of the DTFTs of these windows for M=25 are shown below:
§10.2.4 Fixed Window Functions • Magnitude spectrum of each window characterized by a main lobe centered at ω= 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
§10.2.4 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
Observe • Thus, • Passband and stopband ripples are the same §10.2.4 Fixed Window Functions
§10.2.4 Fixed Window Functions • Distance between the locations of the maximum passband deviation and minimum stopband value ML • Width of transition band = s- p < ML
§10.2.4 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 δ, the area under the sidelobesshould be very small • Unfortunately, these two requirements are contradictory
§10.2.4 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, c/ M where c is a constant for most practical purposes
§10.2.4 Fixed Window Functions • Rectangular window - ML=4/(2M+1) Asl=13.3 dB, s=20.9 dB, =0.92/M • Hann window - ML=8/(2M+1) Asl=31.5 dB, s=43.9 dB, =3.11/M • Hamming window - ML=8/(2M+1) Asl=42.7 dB, s=54.5 dB, =3.32/M, • Blackman window - ML=12/(2M+1) Asl=58.1 dB, s=75.3 dB, =5.56/M
§10.2.4 Fixed Window Functions • Filter Design Steps - (1) Set c =(p + s )/2 (2) Choose window based on specified s (3) Estimate Musing c/ M
Lowpass Filter Designed Using Hamming window Lowpass Filter Designed Using Hann window 0 0 Gain, dB -50 -50 Gain, dB -100 -100 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 p w / w p / Lowpass Filter Designed Using Blackman window 0 Gain, dB -50 -100 0 0.2 0.4 0.6 0.8 1 w p / §10.2.4 Fixed Window Functions FIR Filter Design Example • Lowpass filter of length 51 and c=/2
§10.2.4 Fixed Window Functions 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
where and §10.2.5 Adjustable Window Functions • Dolph-Chebyshev Window –
§10.2.5 Adjustable Window Functions • Dolph-Chebyshev window can be designed with any specified relative sidelobe level while the main lobe width adjusted by choosing length appropriately • Filter order is estimated using where is the normalized transition bandwidth, e.g, for a lowpss filter = s- p
§10.2.5 Adjustable Window Functions • Gain response of a Dolph-Chebyshev window of length 51 and relative sidelobe level of 50dB is shown below
§10.2.5 Adjustable Window Functions Properties of Dolph-Chebyshev window: • All sidelobes are of equal height • Stopband approximation error of filters designed have essentially equiripple behavior • For a given window length, it has the smallest main lobe width compared to other windows resulting in filters with the smallest transition band
In practice §10.2.5 Adjustable Window Functions • Kaiser Window– where βis an adjustable parameter and I0(u) is the modified zeroth-order Bessel function of the first kind: • Note I0(u)>0 for u>0
§10.2.5 Adjustable Window Functions • βcontrols the minimum stopband attenuation of the windowed filter response • βis estimated using • Filter order is estimated using where is the normalized transition bandwidth
§10.2.5 Adjustable Window Functions FIR Filter Design Example • Specifications: p= , s= , c=40 dB • Thus • Choose N=24 implying M=1
Lowpass filter designed with Kaiser window Kaiser Window 0 0 -20 -20 Gain, dB Gain, dB -40 -40 -60 -60 -80 -80 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 w p / w p / §10.2.5 Adjustable Window Functions FIR Filter Design Example • Hence ht[n]=sin(0.4n)/ n, -12n12 where w[n] is the n-th coefficient of a length-25Kaiser window with =3.3953
§10.2.6 Impulse Responses of FIR Filters with a Smooth Transition • First-order spline passband-to-stopband transition
§10.2.6 Impulse Responses of FIR Filters with a Smooth Transition • Pth-order spline passband-to-stopband transition
§10.2.6 Impulse Responses of FIR Filters with a Smooth Transition • Lowpass FIR Filter Design Example
§10.3 Computer-Aided Design of Equiripple Linear-Phase FIR Filters • The FIR filter design techniques discussed so far can be easily implemented on a computer • In addition, there are a number of FIR filter design algorithms that rely on some type of optimization techniques that are used to minimize the error between the desired frequency response and that of the computer-generated filter
§10.3 Computer-Aided Design of Equiripple Linear-Phase FIR Filters • Basic idea behind the computer-based iterative technique • Let H(ejω) denote the frequency response of the digital filter H(z) to be designed approximating the desired frequency response D(ejω), given as a piecewise linear function of ω, in some sense
§10.3 Computer-Aided Design of Equiripple Linear-Phase FIR Filters • Objective- Determine iteratively the coefficients of H(z) so that the difference between H(ejω) and D(ejω) over closed subintervals of 0≤ω≤π is minimized • This difference usually specified as a weighted error function ε(ω)=W(ejω)[H(ejω)-D(ejω)] where W(ejω) is some user-specified weighting function
§10.3 Computer-Aided Design of Equiripple Linear-Phase FIR Filters • Chebyshev or minimax criterion- Minimizes the peak absolute value of the weighted error: where Ris the set of disjoint frequency bands in the range 0≤ω≤π, on which D(ejω) is defined
§10.3 Computer-Aided Design of Equiripple Linear-Phase FIR Filters • The linear-phase FIR filter obtained by minimizing the peak absolute value of is usually called the equiripple FIR filter • After ε is minimized, the weighted error function ε(ω) exhibits an equiripple behavior in the ferquency range R
where the amplitude response is a real function of ω §10.3.1 the Parks-McClellan Algorithm • The general form of frequency response of a causal linear-phase FIR filter of length 2M+1: • Weighted error function is given by where D(ω) is the desired amplitude response and W(ω) is a positive weighting function