Finite Impulse Response (FIR) Digital Filters (III)yoga/courses/DSP/P12_FIR_Windowing.pdf · •FIR...
Transcript of Finite Impulse Response (FIR) Digital Filters (III)yoga/courses/DSP/P12_FIR_Windowing.pdf · •FIR...
1
Finite Impulse Response (FIR)
Digital Filters (III)
Impulse Response Coefficients calculation with the Window method
Yogananda Isukapalli
2
• Ideal filter design equations:
å¥
-¥=
-=n
jnwDD enhH ][)(w
ò-
=p
p
wp
dweHnh jnwDD )(
21][
• Exact approximation of the desired requires aninfinite number of coefficients for , which are alsoknown as the Fourier coefficients.
Ideal Impulse Response Design
where and are the ideal frequency response and the ideal impulse response respectively.
)(wDH )(nhD
)(wDH)(nhD
3
• Ideal Low Pass impulse response design
We have, ò-
=p
p
wp
dweHnh jnwDD )(
21][ (1)
For the ideal low pass frequency response in Fig 1(a), the ideal impulse response shown in Fig 1b, is obtained as follows:
rule) sHopital'L' (using 0 ,2
,0 , )sin(2
211
21)(
==
¥££¥-¹=
=´= òò--
nf
nnnnf
dedenh
c
c
cc
njnjD
c
c
ww
wp
wp
w
w
wp
p
w
(2)
4
Fig 11. (a) Ideal frequency response of a low pass filter (b) Impulse response of the
ideal low pass filter
• The impulse responses of the ideal high pass, band pass and band stop filters are obtained from the low pass case of eqn (2) and are summarized in Table 1.
5
Table 11. Summary of ideal impulse responses for standard frequency selective filters
6
• FIR filter design requires the truncation of {h[n]} for some n = ±M
Fig 2. Low pass filter frequency response for 101 and 151 coefficient designs
• The direct truncation method exhibits Gibb’s phenomenon implying there exists an overshoot of 8.95% at the point of discontinuity for a large M.
Overshootof 0.09 forboth cases
7
Windowing concept:
Given the infinite sequence from the design equation
ò-
=p
p
wp
dweHnh jnwDD )(
21][
)...}25(),24()...,1(),0(),1()...24(),25({... hhhhhhh ---
Window functions
• A window function is used to obtain a finite impulse response from an ideal infinite impulse response.
• If is the impulse response for an ideal filter and w[n] issome window function which is zero outside the range
then a finite impulse response filter is obtained as
)(nhD
10 -££ Nn
]}[]}{[{][ nwnhnh D=where is the finite impulse response. ][nh
8
Multiply by w[n]
...}0,0,0,1,1,1...1,1,1,0,0,0{...][ =nw
n=-20 n=20
Define the “windowed” filter coefficients:
Infinite sequence Finite length window
21
where ,][)( -=
-
-=å= N
Mjnw
M
Mn
enhH w
jnwM
Mnenwnh -
-=å= ][][
Truncation is equivalent to a rectangular window: otherwiseMnnw £= ||
,0,1][
]}[]}{[{][ nwnhnh D=
9
Fig 31. An illustration of how the filter coefficients, h(n), are determined by the window method
10
Consider rectangular window design:
][][][ nwMnhnh D -=
îíì ££-
=otherwise
MnMnhD0
20][
jwMjDD eeHMnh -«- )(][ w
)(][ jweWnw «
)2
sin(
)2
)12(sin(]}[{)( w
Mw
nwDFTeW jw
+
==
)( )()( jwjwMjwD
jw eWeeHeH *= -
Windowing: Convolution interpretation
11
Desirable window properties
2. Side lobes of the frequency response should decrease in energy as . This will lead to a filter with higher stop band attenuation.
1. Small width of main lobe of the frequency response of the window which results in a filter with a lower transition width.
p®w
• Various window functions have been proposed:-
• Rectangular window• Hanning window• Hamming window• Blackmann window• Kaiser window
12
Table 21. Summary of important features of common window functions
13
• We observe that the window functions other than the Kaiser window, have fixed characteristics, such as transition width and stop band attenuation.
Fig 41. Comparison of the time and frequency domain characteristics of common window functions(a) rectangular; (b) Hamming; (c) Blackman
14
Example:
Solution:
15
16
• We note that the indices of the filter coefficients run from -26 to 26. We make the filter causal by adding 26 to each index so that the indices start at zero.
• The filter coefficients, with indices adjusted, are listed in Table 3.
Table 31
17
Kaiser Window – Adjustable Window Function
The most widely used adjustable window function is theKaiser window function. Kaiser found that a near-optimal window function could be formed by using the zeroth-order modified Bessel function of the first kind.The Kaiser window is given by:
ïî
ïíì
=--
)(})1/2(1{
00
20
][ bb
INnI
nw2/)1(2/)1( -££-- NnN
otherwise
where I0(.) represents the zeroth-order modified Bessel function of the first kind given by:
2
1 !)2/(1)( å
=úû
ùêë
é+=
L
k
k
o kx
xI where typically, L< 25.
18
Design Using Kaiser Window Functioncontd....
• The Kaiser window has two parameters:1) Length (N = 2M+1) 2) Shape Parameter b
• By varying these two parameters the window length and shape can be adjusted to trade sidelobe amplitude for mainlobe width.
• The parameter b controls the minimum attenuation as i.e., ripple ds in the stop band of the windowed filter response.
19
Design Using Kaiser Window Functioncontd....
Estimation of b and the filter length N=2M+1 for a givenas and transition bandwidth Df is determined empirically.
0.1102(as -8.7), for as > 50b = 0.5842(as -21)0.4+0.07886(as -21) for 21 £ as £ 50
0 for as < 21for as > 21
N = for as £ 21
136.1495.7
+D
-f
sa
19222.0+
Df
Note: The kaiser window does not provide independent control over the passband ripple dp. However in practice, dp is equal to ds.
20
Design Using Kaiser Window Function contd...
<-- Samples -->0 5 10 15 20 25 300
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
<--A
mpl
itude
-->
b=0b=3b=6, M=29
By varying the two parameters M and b , the window shape could be adjusted to trade sidelobe amplitude for the mainlobe width. The figure below shows continuous envelopes of kaiser window of length M=29 and b=0, 3, 6Notice the shape as b varies from 0 to higher values.
21
Design Using Kaiser Window Function contd...
Taking the fourier transform of the obtained windows we see from the figures below we notice the tradeoff between the width of the mainlobe and the amplitude of the sidelobes. If the window is tapered more, the sidelobes of the fourier transform become smaller, but the main lobe becomes wider.
b = 0
0 0.2 0.4 0.6 0.8 1-400
-300
-200
-100
0
100
Normalized frequency (Nyquist == 1)
Phas
e (d
egre
es)
0 0.2 0.4 0.6 0.8 1-100
-50
0
50
Normalized frequency (Nyquist == 1)
Mag
nitu
de R
espo
nse
(dB)
0 0.2 0.4 0.6 0.8 1-300
-200
-100
0
100
Normalized frequency (Nyquist == 1)
Phas
e (d
egre
es)
0 0.2 0.4 0.6 0.8 1-60
-40
-20
0
20
40
Normalized frequency (Nyquist == 1)
Mag
nitu
de R
espo
nse
(dB)
0 0.2 0.4 0.6 0.8 1-200
-100
0
100
Normalized frequency (Nyquist == 1)
Phas
e (d
egre
es)
0 0.2 0.4 0.6 0.8 1-60
-40
-20
0
20
40
Normalized frequency (Nyquist == 1)
Mag
nitu
de R
espo
nse
(dB) b = 3 b = 6
22
Design Using KaiserWindow Function Example
• Specification of a Lowpass Filter:wp= 0.3p, passband edge frequencyws=0.4 p, stopband edge frequencyas =50dB attenuation
• We have wc = (wp + ws)/2 = 0.35p• We know as = -20log10(ds )dB. Thus ds=0.00316• We know how to calculate b for a given as.Thus b = 4.5335. • The transition bandwidth Df is given by Df = (ws - wp)/2p =0.05 • Next we determine N using the empirical formula given in the earlier slide. We get N = 59.565 we choose the next higher odd value i.e., 61. Thus M = 30.
Soln)
23
Design Using Kaiser Window Function Example
For the calculated window parameters the kaiser window is :
Its Fourier transform is given by:0 10 20 30 40 50 60 70
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1-400
-300
-200
-100
0
100
Normalized frequency (Nyquist == 1)
Phas
e (d
egre
es)
0 0.2 0.4 0.6 0.8 1-100
-50
0
50
Normalized frequency (Nyquist == 1)
Mag
nitu
de R
espo
nse
(dB)
24
Design Using KaiserWindow Function Example
We obtain the impulse-response coefficients of the required FIR filter by windowing the ideal filter function.
c
c
cc
f
nwn
nwfnh
2
][.sin2][
=
=w
MnMn ££-¹ ,0
For M=30 and wc=0.35p we get the coefficients to be :
0 10 20 30 40 50 60 70-0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0=n
25
Design Using KaiserWindow Function Example
The Magnitude Response of the obtained Filter is :
0 0.2 0.4 0.6 0.8 1-120
-100
-80
-60
-40
-20
0
20
<-- Normalized Frequency -->
<-- G
ain
-->
26
Advantages and disadvantages of the window method
• The window method is simple to apply and simple to understand.
• The major disadvantage is lack of flexibility, for example equal peak pass band and stop band ripples, which is generally undesirable.
• Because of the effect of convolution of the spectrum of the window function and the desired response, the pass band and stop band edge frequencies cannot be precisely specified.
27
References
1. “Digital Signal Processing – A Practical Approach” -Emmanuel C. Ifeachor and Barrie W. Jervis Second Edition