Loading documents preview...
Least Integral-Squared Error Design of FIR Filters
1
• 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 j H d (e ) hd [n]e jn n where 1 j jn hd [n] H ( e )e d, n d 2
Copyright © 2005, S. K. Mitra
Least Integral-Squared Error Design of FIR Filters • In general, H d (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 H t (e j ) j H ( e ) in approximates the desired DTFT d some sense 2 Copyright © 2005, S. K. Mitra
Least Integral-Squared Error Design of FIR Filters • Commonly used approximation criterion Minimize the integral-squared error 1 j j 2 H t (e ) H d (e ) d 2 where j
M
H t (e ) ht [n]e
jn
n M
3 Copyright © 2005, S. K. Mitra
Least Integral-Squared Error Design of FIR Filters • Using Parseval’s relation we can write
2
n M
2
ht [n] hd [n]
M 1
ht [n] hd [n] n M
4
n
hd2 [n]
2 h d [ n]
n M 1
• 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 Copyright © 2005, S. K. Mitra
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 M radians with respect to that of ht [n] 5 Copyright © 2005, S. K. Mitra
Impulse Responses of Ideal Filters • Ideal lowpass filter -
sin c n hLP [n] n , n
• Ideal highpass filter -
6
1 c , n 0 hHP [n] sin( c n) n , n 0 Copyright © 2005, S. K. Mitra
Impulse Responses of Ideal Filters • Ideal bandpass filter -
sin( c 2n) sin( c1n) , n 0 n n hBP [n] c 2 c1 , n 0 7 Copyright © 2005, S. K. Mitra
Impulse Responses of Ideal Filters • Ideal bandstop filter -
1 (c 2 c1 ) , n 0 hBS [n] sin( c1n) sin( c 2n) n , n0 n 8 Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • Gibbs phenomenon - Oscillatory behavior in the magnitude responses of causal FIR filters obtained by truncating the impulse response coefficients of ideal filters Magnitude
1.5 1 0.5 0
9
N = 20 N = 60
0
0.2
0.4
0.6 /
0.8
1 Copyright © 2005, S. K. Mitra
Gibbs Phenomenon
10
• 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 Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • Gibbs phenomenon can be explained by treating the truncation operation as an windowing operation: ht [n] hd [n] w[n] • In the frequency domain
H t ( e j )
11
1 2
j j ( ) H ( e ) ( e ) d d
• where H t (e j ) and (e j ) are the DTFTs of ht [n] and w[n] , respectively Copyright © 2005, S. K. Mitra
Gibbs Phenomenon j H ( e ) is obtained by a periodic • Thus t continuous convolution of H d (e j ) with ( e j )
12 Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • If (e j ) is a very narrow pulse centered at 0 (ideally a delta function) compared to variations in H d (e j ), then H t (e j ) will approximate H d (e j ) 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 13 Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • A rectangular window is used to achieve simple truncation: 1, 0 n M wR [n] 0, otherwise j • Presence of oscillatory behavior in H t (e ) is basically due to: – 1) hd [n] is infinitely long and not absolutely
14
summable, and hence filter is unstable – 2) Rectangular window has an abrupt transition to zero Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • Oscillatory behavior can be explained by j examining the DTFT R (e ) of wR [n] : 30
Rectangular window
Amplitude
20 10
15
side lobe
M=4
0 -10 -1
j
main lobe
M = 10
-0.5
0 /
0.5
1
• R (e ) has a main lobe centered at 0 • Other ripples are called sidelobes Copyright © 2005, S. K. Mitra
Gibbs Phenomenon
16
• Main lobe of R (e j ) characterized by its width 4 /(2M 1) defined by first zero crossings on both sides of 0 • 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 j • Ripples in H t (e ) around the point of discontinuity occur more closely but with no decrease in amplitude as M increases Copyright © 2005, S. K. Mitra
Gibbs Phenomenon • Rectangular window has an abrupt transition to zero outside the range M n M , which results in Gibbs phenomenon in H t (e j ) • 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 17 Copyright © 2005, S. K. Mitra
Fixed Window Functions
18
• 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.5 cos( 2 n ), M n M 2M 1 • Hamming: 2 n M n M w[n] 0.54 0.46 cos( ), 2M 1 • Blackman: 2 n n 4 w[n] 0.42 0.5 cos( ) 0.08 cos( ) 2M 1 2M 1 Copyright © 2005, S. K. Mitra
Fixed Window Functions • Plots of magnitudes of the DTFTs of these windows for M = 25 are shown below: Hanning window Hann window
0
0
-20
-20
Gain, dBdB Gain,
Gain,dBdB Gain,
Rectangular window Rectangular window
-40 -60
-60 -80
-80 -100
-40
0
0.2
0.4
0.6
0.8
-100
1
0
0.2
0
-20
-20
Gain,dBdB Gain,
Gain, dBdB Gain,
0
-60 -80
19
-100
0.6
0.8
1
0.8
1
/ Blackman Blackman window window
/ Hamming Hamming window window
-40
0.4
-40 -60 -80
0
0.2
0.4
0.6 /
0.8
1
-100
0
0.2
0.4
0.6
/ Copyright © 2005, S. K. Mitra
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 20 Copyright © 2005, S. K. Mitra
Fixed Window Functions • Main lobe width ML - given by the distance between zero crossings on both sides of main lobe • Relative sidelobe level As - given by the difference in dB between amplitudes of largest sidelobe and main lobe
21 Copyright © 2005, S. K. Mitra
Fixed Window Functions
• Observe H t (e j (c ) ) H t (e j (c ) ) 1 j c H t (e ) 0.5 • Thus, • Passband and stopband ripples are the same 22 Copyright © 2005, S. K. Mitra
Fixed Window Functions • Distance between the locations of the maximum passband deviation and minimum stopband value ML
• Width of transition band s p ML 23 Copyright © 2005, S. K. Mitra
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 24 Copyright © 2005, S. K. Mitra
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 25 Copyright © 2005, S. K. Mitra
Fixed Window Functions • Rectangular window - ML 4 /(2M 1) As 13.3 dB, s 20.9 dB, 0.92 / M • Hann window - ML 8 /(2M 1) As 31.5 dB, s 43.9 dB, 3.11 / M • Hamming window - ML 8 /(2M 1) As 42.7 dB, s 54.5 dB, 3.32 / M • Blackman window - ML 12 /(2M 1) As 58.1 dB, s 75.3 dB, 5.56 / M 26 Copyright © 2005, S. K. Mitra
FIR Filter Design Example • Lowpass filter of length 51 and c / 2 Lowpass Filter Designed Using Hamming window 0
Gain, dB
Gain, dB
Lowpass Filter Designed Using Hann window 0
-50
-50
-100
-100 0
0.2
0.4
0.6
0.8
0
1
0.2
0.4
0.6
0.8
1
/
/
Gain, dB
Lowpass Filter Designed Using Blackman window 0
-50
-100
27
0
0.2
0.4
0.6 /
0.8
1
Copyright © 2005, S. K. Mitra
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
28 Copyright © 2005, S. K. Mitra