Sunteți pe pagina 1din 16

Design of FIR filters using windows

The desired frequency response Hd(ejω) of a filter is periodic in frequency and can be
expanded using Fourier series. The resultant series is


H d (e jω ) = ∑ h ( n) e
n = −∞
d
− jωn

where

π
1
∫π H (e

hd (n) = )
2π −

are known as Fourier coefficients having infinite length.

One possible way of obtaining FIR filter is to truncate the infinite Fourier series at n = ±
(N-1)/2, where N is the length of the desired sequence.

But abrupt truncation results in oscillation in the passband and stopband. These
oscillations are due to slow convergence of the Fourier series and this effect is known as
Gibbs phenomenon.

To reduce these oscillations, the Fourier coefficients of the filter are modified by
multiplying the infinite impulse response with a finite weighing sequence w(n) called as
window, where

w(n) = w(-n) ≠ 0 for |n| ≤ (N-1)/2


=0 for |n| > (N-1)/2

After multiplying window sequence w(n) and hd(n), we get a finite duration sequence
h(n) that satisfies the desired magnitude response

h(n) = hd(n) w(n) ; |n| ≤ (N-1)/2


=0 ; otherwise

The frequency response H(ejω) of the filter can be obtained by convolution of Hd(ejω) and
W(ejω) given by

H(ejω) = Hd(ejω) * W(ejω)

1
H ( e jω ) =
2π ∫ H d (e jθ )W (e j (ω −θ ) )dθ
Impulse response
Hd(ejω)

1.0

-ωc ωc ω

Impulse sequence
hd(n)

Frequency response of window function


WR(ejω)

-π π

-2π/N 2π/N

Window sequence
w(n)

n
Filter response
H(ejω)

0 ω

Filter impulse
h(n) = hd(n) w(n)

-(N-1)/2 (N-1)/2
n

Delayed sequence
g(n)

0 N-1
n

Note: We find that the frequency response of the filter H(ejω) depends on the frequency
response of window W(ejω). Therefore, the window, chosen for truncating the infinite
impulse response should have some desirable characteristics. They are

1. The central lobe of the frequency response of the window should contain most of
the energy and should be narrow.
2. The highest side lobe level of the frequency response should be small.
3. The side lobes of the frequency response should decrease in energy rapidly as ω
tends to π.
Rectangular window:

The rectangular window sequence is given by,

wR(n) = 1 ; -(N-1)/2 ≤ n ≤ (N-1)/2


=0 ; otherwise

The spectrum of the rectangular window is given by

N −1
2
WR (e jω ) = ∑e N −1
− j ωn

n=−
2
N −1 N −1
jω − jω
2 jω − jω 2
=e + ........... + e +1 + e + ........... + e
N −1

=e 2
[1 + e − jω
+ ............. + e − jω ( N −1) ]

N −1
2
1 − e 
− jωN
=e  1 − e − jω 
 
N

e 2
(1 − e − jωN )
= 1

e 2
(1 − e − jω )
N N
jω − jω
2 2
e −e
= 1 1
jω − jω
2 2
e −e
ωN
sin
= 2
ω
sin
2

Rectangular window sequence for N=25


wR(n)

-12 12
Frequency response of rectangular window for N= 25

WR(ejω)

1.0

-1 1

-2π/N 2π/N

Log magnitude response of rectangular window for N = 25

|WR(ejω)|dB
0
-13dB

0 0.5 1
Normalized frequency ω/π

To get a finite impulse response filter we multiply hd(n) with a rectangular window, i.e.,

h(n) = hd(n)wR(n)

The frequency response of the truncated filter can be obtained by periodic convolution,
1
2π ∫
H ( e jω ) = H d (e jθ )WR (e j (ω −θ ) )dθ

Frequency response of LPF using rectangular window for N = 25

|H(ejω)|

1.0

0 1
Normalized frequency ω/π
Log magnitude response of LPF using rectangular window for N = 25

|H(ejω)|dB
0
-21dB

0 0.5 1
Normalized frequency ω/π

Note:

The Gibbs phenomenon can be reduced by using a less abrupt truncation of filter
coefficients. This can be achieved using a window function that tapers smoothly towards
at both ends, eg: Triangular window.
Triangular or Bartlett window:

The N – point triangular window is given by,

2| n | ( N − 1) ( N − 1)
wT (n) =1 − ; − ≤n≤
N −1 2 2

Triangular window sequence for N = 25

wT(n)

N=25,

n
-12 12

The Fourier transform of the triangular window is

2
  N −1 
 sin  ω 

WT (e ) =   4  
 ω 
 sin 
 2 

Frequency response of triangular window for N= 25

WT(ejω)

1.0

-1 1

-4π/N 4π/N
Log magnitude response of Triangular window for N = 25

|WT(ejω)|dB
0
-27dB

0 0.5 1
Normalized frequency ω/π

To get a finite impulse response filter we multiply hd(n) with a rectangular window, i.e.,

h(n) = hd(n) wT(n)

The frequency response of the truncated filter can be obtained by periodic convolution,

1
H (e jω ) =
2π ∫ H d (e jθ )WT (e j (ω −θ ) )dθ

Frequency response of LPF using Triangular window for N = 25


|H(ejω)|
1.0

0 1
Normalized frequency ω/π

Log magnitude response of LPF using Triangular window for N = 25


|H(ejω)|dB
0

0 0.5 1
Normalized frequency ω/π

Due to the following reasons, the triangular window is not usually a good choice.
1. Transition region is more
2. Stopband attenuation is very less
Raised Cosine Window:

The raised cosine window multiplies the central Fourier coefficients by approximately
unity and smoothly truncate the Fourier coefficients toward the ends of the filter.

The window sequence is of form,

wα(n) = α + (1-α) cos (2πn/(N-1)) ; -((N-1)/2) ≤ n ≤ ((N-1)/2)


=0 ; otherwise

The frequency response wα(n) is given by,

N −1
2
 2πn  − jωn
Wα (e jω ) = ∑ 
N −1 
α + (1 − α ) cos
N − 1
e
n=−
2

ωN  ωN πN   ωN πN 
sin (1 − α ) sin  −  (1 − α ) sin  + 
=α 2 +  2 N −1
+  2 N −1
ω ω π  ω π 
sin 2 sin  −  2 sin  + 
2  2 N −1  2 N −1
Hanning window:

The Hanning window sequence can be obtained by substituting α = 0.5 in the Raised
Cosine function.

WHn(n) = 0.5 + 0.5 cos (2πn/(N-1)) ; -((N-1)/2) ≤ n ≤ ((N-1)/2)


=0 ; otherwise

The frequency response wα(n) is given by,

ωN  ωN πN   ωN πN 
sin sin  −  sin  + 
WHn (e jω ) = 0.5 2 + 0.25  2 N −1 
+ 0.25  2 N −1 
ω ω π  ω π 
sin sin  −  sin  + 
2  2 N −1   2 N −1 
Hanning window sequence

wHn(n)

N=25,

n
-12 12

Frequency response of Hanning window for N= 25

WHn(ejω)

1.0

-1 1

-4π/N 4π/N
Log magnitude response of Hanning window for N = 25

|WHn(ejω)|dB
0
-32dB

0 0.5 1
Normalized frequency ω/π

To get a finite impulse response filter we multiply hd(n) with a rectangular window, i.e.,

h(n) = hd(n)wHn(n)

The frequency response of the truncated filter can be obtained by periodic convolution,
1
2π ∫
H (e jω ) = H d (e jθ )WHn (e j (ω −θ ) )dθ

Frequency response of LPF using Hanning window for N = 25

|H(ejω)|

1.0

0 1
Normalized frequency ω/π

Log magnitude response of LPF using Hanning window for N = 25

|H(ejω)|dB
0

-44dB

0 0.5 1
Normalized frequency ω/π

Note: At higher frequencies, the stopband attenuation is ever greater.


Hamming Window

The equation for Hamming window is obtained by substituting α = 0.54 in the Raised
Cosine function.

wH(n) = 0.54 + 0.46 cos (2πn/(N-1)) ; -((N-1)/2) ≤ n ≤ ((N-1)/2)


=0 ; otherwise

The frequency response wα(n) is given by,

ωN  ωN πN   ωN πN 
sin sin  −  sin  + 
WH (e jω ) = 0.54 2 + 0.23  2 N −1 
+ 0.23  2 N −1 
ω ω π  ω π 
sin sin  −  sin  + 
2  2 N −1  2 N −1 

Hamming window sequence

wH(n)

N=25,

n
-12 12

Frequency response of Hamming window for N= 25

WH(ejω)

1.0

-1 1

-4π/N 4π/N
Log magnitude response of Hamming window for N = 25

|WH(ejω)|dB
0
-43dB

0 0.5 1
Normalized frequency ω/π

To get a finite impulse response filter we multiply hd(n) with a rectangular window, i.e.,

h(n) = hd(n)wH(n)

The frequency response of the truncated filter can be obtained by periodic convolution,
π
1
2π −∫π
H (e jω ) = H d (e jθ )WH (e j (ω −θ ) )dθ

Frequency response of LPF using Hamming window for N = 25

|H(ejω)|

1.0

0 1
Normalized frequency ω/π

Log magnitude response of LPF using Hamming window for N = 25

|H(ejω)|dB
0

-53dB

0 0.5 1
Normalized frequency ω/π

Note: At higher frequencies, the stopband attenuation is ever greater.


Blackman Window

The Blackman window sequence is given by,

wB(n) = 0.42 + 0.5 cos(2πn/(N-1)) + 0.08 cos(4πn/(N-1)) ; -((N-1)/2) ≤ n ≤ ((N-1)/2)


=0 ; otherwise

Note: Additional cosine terms reduces the side lobes but main lobe width is increased.

Blackman window sequence


wB(n)

N=25,

n
-12 12

Frequency response of Blackman window for N= 25

WB(ejω)

1.0

-1 1

-6π/N 6π/N
Normalized frequency ω/π
Log magnitude response of Blackman window for N = 25

|WB(ejω)|dB
0
-58dB

0 0.5 1
Normalized frequency ω/π

To get a finite impulse response filter we multiply hd(n) with a rectangular window, i.e.,

h(n) = hd(n)wB(n)

The frequency response of the truncated filter can be obtained by periodic convolution,
π
1
2π −∫π
H (e jω ) = H d (e jθ )WB (e j (ω −θ ) )dθ

Frequency response of LPF using Blackman window for N = 25

|H(ejω)|

1.0

0 1
Normalized frequency ω/π

Log magnitude response of LPF using Blackman window for N = 25

|H(ejω)|dB
0

-74dB

0 0.5 1
Normalized frequency ω/π
Comparison of different types of windows

Window type Main lobe width Highest side lobe Minimum stopband
level attenuation

Rectangular 4π/N -13 dB -21 dB


Bartlett or Triangular 8π/N -27 dB Very less
Hanning 8π/N -32 dB -44 dB
Hamming 8π/N -43 dB -53 dB
Blackman 12π/N -58 dB -74 dB

S-ar putea să vă placă și