0% found this document useful (0 votes)
112 views8 pages

Design of Analog Filters

The document describes designing a finite impulse response (FIR) low-pass filter with given specifications and comparing different windowing functions. It involves: 1. Designing a Kaiser window FIR filter meeting the specifications as a benchmark. 2. Applying Hanning, Hamming, Blackman, Blackman-Harris windows to the ideal filter impulse response. 3. Analyzing the frequency responses which shows only Kaiser meets specifications, providing the sharpest roll-off while allowing minor passband ripple.

Uploaded by

Alamgir Mohammed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views8 pages

Design of Analog Filters

The document describes designing a finite impulse response (FIR) low-pass filter with given specifications and comparing different windowing functions. It involves: 1. Designing a Kaiser window FIR filter meeting the specifications as a benchmark. 2. Applying Hanning, Hamming, Blackman, Blackman-Harris windows to the ideal filter impulse response. 3. Analyzing the frequency responses which shows only Kaiser meets specifications, providing the sharpest roll-off while allowing minor passband ripple.

Uploaded by

Alamgir Mohammed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment #3: Design of FIR Filter and Comparison of

Windowing Functions
Mohammed Alamgir
November 21, 2013

Problem
A finite impulse response (FIR) low-pass filter needs to be designed with specifications

Passband frequency: p = 3000Hz,

Passband ripple: 1dB,

Stopband frequency: a = 5000Hz,

Stopband attenuation: 30dB.


(1)

The sampling rate is given as s = 20, 000Hz. When designing the filter, Hanning, Hamming,
Blackman and Kaiser window should be used to contain the ripple due to Gibbs effect.

Ideal Low-pass Filter

An ideal low-pass filter (Fig.1) has a frequency response with zero transition band. Such a filter
has sinc impulse response which extends to infinite. For practical purpose the impulse response
must be truncated. This however, when done leaves a ripple on the frequency response (Fig.2).
Truncating the impulse response is the same as multiplying it with a rectangular window.
To reduce the ripple in the frequency spectrum a different window is used where the truncation
happens in a tapered manner. Some of the commonly available windows reported in the literature
are Hann, Hamming, Blackman and Kaiser. Among these only Kaiser window allows a design for
given passband/stopband attenuation while the others are trial-and-go types. Since we have to
compare the relative performance of the windows a common filter length is required. We will also
have to decide on the common cut-off frequency, which is usually taken as
c =

a + p
= (3000 + 5000)/2 = 4000Hz.
2

(2)

Amplitude

Gain
0

0
Time

0
Frequency

Figure 1: Ideal low-pass filter: frequency and impulse response.

Gain

Amplitude

Gibbs ripple

0
Time

0
Frequency

Figure 2: Truncated impulse response and corresponding effect on the frequency response of a
low-pass filter.

Filter Length

To determine the filter length, we will first design the Kaiser window. Below are the steps of
designing Kaiser window:
1. p =

100.05 1
100.05 +1

= 0.0575 and a = 100.0530 = 0.0316

2. = min{p , a } = 0.0316.
3. A = 20log() = 20log(0.0316) 30dB.
4. This value of A matches the second condition and gives
= 0.5842 (30 21)0.4 + 0.07866 (30 21) = 2.1166.
5. For A = 30dB we find
D=

(30 7.95)
= 1.5355.
14.36

6. Finally we have
N

s D
20000 2 1.5355
+ 1 = 16.355.
+1=
Bt
(5000 3000) 2

The lowest N that satisfies the condition is N = 17 .

Hann and Hamming Windows

The Hann and Hamming windows are given by



+ (1 ) cos N2n
1
wH (nT ) =
0

for |n| N 21
otherwise

where = 0.5 for Hann and = 0.54 for Hamming window. Because of the symmetry, only
(N 1)/2 values are required to calculate to get a whole window.

Blackman and Blackman-Harris

Blackman window considers a sidelobe in addition to the main lobe of the sinc function. Namely,
Blackmann window is given by

4n
for |n| N 21
0.42 + 0.5 cos N2n
1 + 0.08 cos N 1
wB (nT ) =
0
otherwise.
Similar to this, but consider one more sidelobe is Blackmann-Hariss window, which is given as

4n
6n
for |n| N 21
0.3587 0.4882 cos N2n
1 + 0.1412 cos N 1 0.0116 cos N 1
wBH (nT ) =
0
otherwise.
3

Window functions
1
Hann
Hamming
Blackman
BlackHarris
Kaiser

0.9

0.8

0.7

Amplitude

0.6

0.5

0.4

0.3

0.2

0.1

0
8

0
Sample Number

Figure 3: Different window functions.

Kaiser Window

Continuing the design from Sec.2, the Kaiser window is given by


(
I0 ()
for |n| N 21
I0 ()
wK (nT ) =
0
otherwise
where I0 () is the zeroth order Bessel of first kind, and we have = 2.1166,
s
2

2n
.
= 1
N 1

Window Shapes

Each of the window functions discussed above has been implemented in Matlab. Whenever, there
is a singularity condition of the form 0/0 lHopitals rule has been applied to avoid infinite value.
The windows are shown in Fig.3.

Impulse response of desired filter

Impulse response of desired filter Hann window

0.4

0.4

0.35

0.35

0.3

0.3
0.25

0.2

Amplitude

Amplitude

0.25

0.15
0.1

0.05

0.05
6

0
2
Sample Number

Figure 4: Impulse without any window.

0.15
0.1

0.05

0.1
8

0.2

0.05
8

0
2
Sample Number

Figure 5: Different window functions.

Impulse Response

The impulse response of the filter without any window can be found from the sinc function
h(nT ) =

sin(c nT )
, where n = 1, , 8
n

with the zeroth value h(0) set to 2c /s = 0.4. Actual impulse response is found by folding this
values and forming a full 17 samples array. This is plotted in in Fig.4. Note that these values are
also the coefficients of the desired FIR filter.

The Filter and Its Frequency Response

The impulse response of the desired filter, when no windowing is used is given in Fig.4. To apply
a window, we multiply each sample with the corresponding sample of the window to get the target
filters coefficient.
g(nT ) = h(nT ) wH (nT )
For example, Fig.5 shows the application of Hann window. One should note the tapering on both
sides due to the windowing.
The real impact of windowing is more clear when the frequency spectrum of the overall filter
is plotted. This is done in Fig.7. Since the impulse response is symmetric, the filter has a linear
phase response across the entire passband as see in Fig.8.

Frequency response of different window functions


20
Only Kaiser meets 30dB requirement
0

Gain, 20log|H(j)| in dB

20

40

60
Rec
Hann
Hamming
Blackman
BlackHarris
Kaiser

80

100

120

140

1000

2000

3000

4000

5000
6000
Frequency in Hz

7000

8000

9000

10000

Figure 6: Frequency response of the filter with different windowing.

Remarks

Looking at the frequency response in Fig.7, we note only the Kaiser window meets the specified
30dB stopband attenuation. The other windows can be made to meet this, but with greater value
of N .
Blackmann and Blackmann-Harris has the best stopband attenuation but roll off is very sloppy.
To see the behaviour in passband we plot the frequency response in linear scale in Fig.8.
The Kaiser window allows slight ripple the passband but it has real sharp roll-off. On the
other extreme, Blackmann-Harris has a very sloppy roll-off, it even attenuates the passband. The
best, one could get is little or no ripple in the passband, a faster roll off and a stopband attenuation
that meets the specification. Considering these factors, Kaiser window is the best amongst all.

Gain, 20log|H(j)| in dB

Frequency and Phase responses


50
0
50
100
150

1000

2000

3000

4000
5000
6000
Frequency in Hz

7000

8000

9000

10000

2000

3000

4000
5000
6000
Frequency in Hz

7000

8000

9000

10000

Phase angle, in rad

0
5
10
Llinear phase
15
20

1000

Figure 7: Frequency and Phase responses of the filter with Hann window.

Frequency response of different window functions


1.4
Rec
Hann
Hamming
Blackman
BlackHarris
Kaiser

1.2

Best one could get

Gain, linear scale

0.8

0.6

0.4

0.2

1000

2000

3000

4000

5000
6000
Frequency in Hz

7000

8000

Figure 8: Frequency response of different windows in linear scale.

9000

10000

You might also like