FIR Filter Design Window methodsite.iugaza.edu.ps/ahdrouss/files/2010/02/ch10-2.pdf · 2012. 3....
Transcript of FIR Filter Design Window methodsite.iugaza.edu.ps/ahdrouss/files/2010/02/ch10-2.pdf · 2012. 3....
١
١
FIR Filter DesignWindow method
Spring 2012
© Ammar Abu-Hudrouss -Islamic University Gaza
Slide ٢Digital Signal Processing
Introduction
c
cH,0,1
)(
0sin
0,
nnn
nnh
c
c
An ideal low-pass filter has a frequency response characteristics
The impulse response of this filter
As we can see h(n) is infinite and hence we need to truncate the higher coefficients.
٢
Slide ٣Digital Signal Processing
Paely-Weiner Theorem
٣
For practical implementation, the filter function should be causal.Paely – Weiner theorem summarize the conditions that should besatisfied to guarantee causality which are :
1. The frequency response H() cannot be zero except at afinite set of points at frequency.
2. The magnitude H() cannot be constant in any finite range offrequencies
3. The Transition between the passband and stopband cannot beinfinitely sharp .
4. Real part and Imaginary part of H() are interdependent byHilbert Transform.
Slide ٤Digital Signal Processing
Practical Filter
٣
Slide ٥Digital Signal Processing
FIR Filter
1
0
M
kknxkbny
122
110
MM zbzbzbbzH
A FIR system can be described by the following difference equation
The transfer function is given by
The impulse response is
Mbbbbnh ,,,, 210
Then H(z) can be expressed as
1
0
)(M
k
kzkhzH
Slide ٦Digital Signal Processing
In this type, the coefficients of impulse response are symmetric
And N = M-1 is even
Type I Symmetric FIR filter
nMhnh 1
Example: consider
But as h(0)=h(6), h(1)=h(5), h(2)=h(4)
65
4321
6543210
zhzhzhzhzhzhhzH
342516 32110 zhzzhzzhzhzH
٤
Slide ٧Digital Signal Processing
Or
Type I Symmetric FIR filter
3210 1122333 hzzhzzhzzhzzH
Converting to DTFT
3cos22cos13cos023 hhhheH j
R
j HeH 3
HR() is a real-valued function but it can be positive or negative, then the phase is given by
0303
R
R
HH
Slide ٨Digital Signal Processing
The result can be generalized
Type I Symmetric FIR filter
2/22/cos212/cos12/cos022/
NhNhNhNh
eH Nj
R
Nj HeH 2/
the phase is given by
02/02/
R
R
HNHN
٥
Slide ٩Digital Signal Processing
In this type, the coefficients of impulse response are symmetric
And N =M -1 is odd
Type II Symmetric FIR filter
nMhnh 1
After mathematic manipulation, we get
2/1
1
2/ 5.0cos212
N
n
Nj nnNheH
The phase is given by
02/02/
R
R
HNHN
Slide ١٠Digital Signal Processing
In this type, the coefficients of impulse response are anti-symmetric
And M =N -1 is even
Type III Symmetric FIR filter
nMhnh 1
After mathematic manipulation, we get
2/
1
2/ sin2
2N
n
Nj nnNheH
The phase is given by
02/02/
R
R
HNHN
٦
Slide ١١Digital Signal Processing
In this type, the coefficients of impulse response are anti-symmetric
And M =N -1 is even
Type IV Symmetric FIR filter
nMhnh 1
After mathematic manipulation, we get
2/1
1
2/ 5.0sin212
N
n
Nj nnNheH
The phase is given by
02/02/
R
R
HNHN
Slide ١٢Digital Signal Processing
Properties of Linear Phase FIR Filters
All the four type have constant group delay (linear phase)
2/Ndd
1. Type I FIR filters have either an even number of zeros or no zeros at z = 1 and z = −1.
2. Type II FIR filters have an even number of zeros or no zeros at z = 1 and an odd number of zeros at z = −1.
3. Type III FIR filters have an odd number of zeros at z = 1 and z = −1.
4. Type IV FIR filters have an odd number of zeros at z = 1 and either an even or odd number of zeros at z = −1.
٧
Slide ١٣Digital Signal Processing
Properties of Linear Phase FIR Filters
•Type I and II are suitable only for lowpass filters•Type III is suitable for designing bandpass filters•Type IV is used mainly for highpass and bandpass
Slide ١٤Digital Signal Processing
Window method
The magnitude responses of four ideal classical types of digital filters are shown in Figure.
٨
Slide ١٥Digital Signal Processing
An ideal low-pass filter has a frequency response characteristics:
To get FIR filter:
hLP (n) is truncated to be defined only between n = -N and n = N
This is equivalent to multiplying h(n) by w (n). Where
Windows method
0sin
0,
nnn
nnh
c
c
LP
otherwise,0
,1)(
NnNw
Slide ١٦Digital Signal Processing
Rectangular window
The resultant functions is given by
The new Hd (), will not be the same as the ideal H (). Gibbs phenomena is raised by this truncation of h(n). The overshot can be reduced by increasing M but the oscillation increases.
nhnwnh LPd
٩
Slide ١٧Digital Signal Processing
other windows
To reduce gibbs phenomena, researchers have use different type of windows such as
1) Bartlett windows
2) Hann Windows
3) Hamming windows
10;1212
1
MnM
Mnnw
101
2cos121
Mn
Mnnw
101
2cos46.054.0
Mn
Mnnw
Slide ١٨Digital Signal Processing
4) Blackman window
5) Kaiser window
6) Lanczose window
101
4cos08.01
2cos5.042.0
Mn
Mn
Mnnw
١٠
Slide ١٩Digital Signal Processing
4) Tukey window
Slide ٢٠Digital Signal Processing
Impulse response for HP, BP and BS Filers
The impulse response of the highpass, bandpass and bandstopare derived by the same method
0sin
0,
nnn
nnh
c
c
0sinsin1
0,
12
12
nnnn
nnh
cc
cc
0sinsin1
0,
21
12
nnnn
nnh
cc
cc
١١
Slide ٢١Digital Signal Processing
Examples
Example 1: Design a bandpass filter using hamming window of length 11. given that c1 = 0.2 and c1 = 0.6
04.0sin6.0sin10,4.0
nnnn
nnh
90102cos46.054.0
nnnw
Solution: M = 11 = 2N + 1
N =5.
substituting in h (n) for bandpass filter and w (n) for hamming window and shifting the result by 5
0,0289.0,1633.0,2449.0
,1156.0,4.0,1156.0,2449.0,1633.0,0289.0,0nh
Slide ٢٢Digital Signal Processing
Examples
Example 1:
90112cos46.054.0
nnnw
substituting in w(n) for hamming window
08.0,1679.0,0379.0,6821.0
,9121.0,0.1,9121.0,6821.0,0379.0,1679.0,08.0nw
The result is achieved by hw(n) = w(n)h(n)
0,0.0049,0.0650-
,0.1671-,0.1055,4.0,0.1055,0.1671-,0.0650-,0.0049,0nhw
١٢
Slide ٢٣Digital Signal Processing
Hamming Window Examples
Example 2 a) Calculate the filter coefficients for a 3-tap FIR lowpass filter
with a cutoff frequency of 800 Hz and a sampling rate of 8,000 Hz using Hamming window
b) Determine the transfer function and difference equation of the designed FIR system.
c) plot the magnitude frequency response
1871.0)1()1(,2.00 hhh
The coefficients of the lowpass filter has been calculated before
2.08000/80022 scc Tf
Slide ٢٤Digital Signal Processing
Hamming Window Examples
nnw cos46.054.0)(
01497.0)2()1(,2.00 www hhh
For Hamming window with M = 3
and for n = 0 ,1, 2
Then the windowed impulse response coefficients are
08.0)2()1(,10 hamhamham www
convert to z-domain 21 1497.02.001497.0)( zzzH
Then the difference equation is )2(01497.0)1(2.0)(01497.0)( nxnxnxny
١٣
Slide ٢٥Digital Signal Processing
Hamming Window Examples
201497.02.001497.0)( jj eeH
)01497.02.001497.0()( jjj eeeH
)cos02994.02.0()( jeH
cos02994.02.0)( H
0cos02994.02.0if0cos02994.02.0if
)(
H
Slide ٢٦Digital Signal Processing
Hamming Window Examples
١٤
Slide ٢٧Digital Signal Processing
Hamming Window Examples
Example 3: a) Design a 5-tap FIR band reject filter with a lower cutoff frequency of
2,000 Hz, an upper cutoff frequency of 2,400 Hz, and a sampling rateof 8,000 Hz using the Hamming window method.
b) Determine the transfer function.
0
sinsin
0,
nnn
nn
nnh
LH
LH
2N + 1 = 5 which leads that N = 2, h (n) is given by
09355.0)4()0(01558.0)3()1(
,9.02
hhhh
h
Then the five samples of h (n ) shifted by 2 is equal to
Slide ٢٨Digital Signal Processing
Hamming Window Examples
2
cos46.054.0)( nnw
00748.0)4()0(00841.0)3()1(
,9.02
ww
ww
w
hhhh
h
For Hamming window with M = 5
and for n = 0 ,1 ,2, 3, 4
Then the windowed impulse response coefficients are
,08.0)4()0(,54.0)3()1(
,12
hamham
hamham
ham
wwww
w
Convert to z-domain 4321 00748.000841.09.000841.000748.0)( zzzzzH