Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Finite Impulse Response (FIR)

Digital Filters (III)


Impulse Response Coefficients calculation with
the Window method

Yogananda Isukapalli

1
Ideal Impulse Response Design

• Ideal filter design equations:


¥
H D (w ) = å D
h [
n = -¥
n ] e
- jnw

p
1
hD [n] = ò D w jnw
H ( ) e dw
2p -p

where H D (w ) and hD (n) are the ideal frequency


response and the ideal impulse response respectively.

• Exact approximation of the desired H D (w ) requires an


infinite number of coefficients for hD (n) , which are also
known as the Fourier coefficients.

2
• Ideal Low Pass impulse response design
p
1
We have, hD [n] = ò D w (1)
jnw
H ( ) e dw
2p -p

For the ideal low pass frequency response in Fig 1(a), the
ideal impulse response shown in Fig 1b, is obtained as
follows:
p wc
1 1
ò ò
j wn j wn
hD (n) = 1 ´ e dw = e dw
2p -p 2p -wc
2 f c sin( nwc )
= , n ¹ 0, - ¥ £ n £ ¥
nwc (2)
= 2 fc , n = 0 (using L' Hopital' s rule)

3
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.
4
Table 11. Summary of ideal impulse responses for standard frequency selective filters

5
• FIR filter design requires the truncation of {h[n]} for
some n = ±M
Overshoot
of 0.09 for
both cases

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.
6
Window functions
• A window function is used to obtain a finite impulse response
from an ideal infinite impulse response.
• If hD (n) is the impulse response for an ideal filter and w[n] is
some window function which is zero outside the range
0 £ n £ N - 1 then a finite impulse response filter is obtained as

h[n] = {hD [n]}{w[n]}


where h[n] is the finite impulse response.
Windowing concept:
Given the infinite sequence from the design equation
p
1
hD [n] = ò w jnw
H ( ) e dw
2p
D
-p

{...h( -25), h( -24)...h( -1), h(0), h(1)..., h( 24), h( 25)...}


7
Multiply by w[n]
w[n] = {...0,0,0,1,1,1...1,1,1,0,0,0...}

n=-20 n=20
Define the “windowed” filter coefficients:
h[n] = {hD [n]}{w[n]}

Infinite sequence Finite length window


M
H (w ) = å h[n]e
n=- M
- jnw
, where M =
N -1
2

M
= å h[
n=- M
n ]w[ n ]e - jnw

1, | n |£ M
Truncation is equivalent to a rectangular window: w[n] =
0, otherwise

8
Fig 31. An illustration of how the filter coefficients, h(n), are determined by the window method

9
Windowing: Convolution interpretation
Consider rectangular window design:
h[n] = hD [n - M ]w[n]

ìh [ n - M ] 0 £ n £ 2M
=í D
î 0 otherwise

hD [n - M ] « H D (e jw )e - jwM

w[n] « W (e jw )

w(2 M + 1)
sin( )
W (e jw ) = DFT {w[n]} = 2
w
sin( )
2
H (e jw ) = H D (e jw )e - jwM * W (e jw )

10
Desirable window properties

1. Small width of main lobe of the frequency response of the


window which results in a filter with a lower transition
width.
2. Side lobes of the frequency response should decrease in
energy as w ® p . This will lead to a filter with higher stop
band attenuation.

• Various window functions have been proposed:-


• Rectangular window
• Hanning window
• Hamming window
• Blackmann window
• Kaiser window
11
Table 21. Summary of important features of common window functions

12
Fig 41. Comparison of the time and frequency domain characteristics of common window functions
(a) rectangular; (b) Hamming; (c) Blackman

• We observe that the window functions other than the Kaiser


window, have fixed characteristics, such as transition width and stop
band attenuation. 13
Example:

Solution:

14
15
• 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
16
Kaiser Window – Adjustable Window Function
The most widely used adjustable window function is the
Kaiser 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:
ì I 0 {b 1- ( 2 n / N -1) 2 } - ( N - 1) / 2 £ n £ ( N - 1) / 2
ï I0 ( b )
w[n] = í 0 otherwise
ïî
where I0(.) represents the zeroth-order modified Bessel
function of the first kind given by:
2
L
é ( x / 2) k ù
I o ( x) = 1 + å ê ú where typically, L< 25.
k =1 ë k! û

17
Design Using Kaiser Window Function
contd....

• 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.

18
Design Using Kaiser Window Function
contd....
Estimation of b and the filter length N=2M+1 for a given
as and transition bandwidth Df is determined empirically.

0.1102(as -8.7), for as > 50


b = 0.5842(as -21)0.4+0.07886(as -21) for 21 £ as £ 50
0 for as < 21
+ 1 for as > 21
a - 7.95
s
14.36Df
N=
for as £ 21
0.9222
+1
Df

Note: The kaiser window does not provide independent control


over the passband ripple dp. However in practice, dp is equal to ds.

19
Design Using Kaiser Window Function contd...

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, 6
Notice the shape as b varies from 0 to higher values.

1 b=0
0.9 b=3
0.8 b=6,
<-- Amplitude -->

0.7
M=29
0.6
0.5
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30
<-- Samples -->

20
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 b=3 b=6


Magnitude Response (dB)

Magnitude Response (dB)

Magnitude Response (dB)


40 40 50
20 20
0 0 0

-20 -20
-50
-40 -40
-60 -60 -100
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized frequency (Nyquist == 1) Normalized frequency (Nyquist == 1) Normalized frequency (Nyquist == 1)
100 100 100
Phase (degrees)

Phase (degrees)

Phase (degrees)
0 0
0
-100
-100
-100 -200
-200
-300
-200 -300 -400
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Normalized frequency (Nyquist == 1) Normalized frequency (Nyquist == 1) Normalized frequency (Nyquist == 1)

21
Design Using Kaiser Window Function Example
• Specification of a Lowpass Filter:
wp= 0.3p, passband edge frequency
ws=0.4 p, stopband edge frequency
as =50dB attenuation
Soln)

• 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.

22
Design Using Kaiser Window Function Example

For the calculated window parameters the kaiser window


is :
1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 10 20 30 40 50 60 70

Its Fourier transform is given by: 50


Magnitude Response (dB)

-50

-100
0 0.2 0.4 0.6 0.8 1
Normalized frequency (Nyquist == 1)

100

0
Phase (degrees)

-100

-200

-300

-400
0 0.2 0.4 0.6 0.8 1
Normalized frequency (Nyquist == 1)

23
Design Using Kaiser Window Function Example

We obtain the impulse-response coefficients of the


required FIR filter by windowing the ideal filter
function. 2 f sin w n
h[n] = c c
.w[n] n ¹ 0, - M £ n £ M
nwc
= 2 fc n=0
For M=30 and wc=0.35p we get the coefficients to be :
0.6

0.5

0.4

0.3

0.2

0.1

-0.1
0 10 20 30 40 50 60 70

24
Design Using Kaiser Window Function Example

The Magnitude Response of the obtained Filter is :


20

-20

-40
<-- Gain -->

-60

-80

-100

-120
0 0.2 0.4 0.6 0.8 1
<-- Normalized F requency -->

25
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.

26
References

1. “Digital Signal Processing – A Practical Approach” -


Emmanuel C. Ifeachor and Barrie W. Jervis
Second Edition

27

You might also like