FIR Filt D iFIR Filt D iFIR Filter DesignFIR Filter Design
1 Finite Impulse Response Filter Format1.Finite Impulse Response Filter Format
2.Fourier Transform Design
3.Window Method
FIR Filter Format (1)FIR Filter Format (1)
Input-output relationshipK
–
b FIR filt ffi i t
0 10
( ) 1K
i Ki
y n b x n i b x n b x n b x n K
• bi: FIR filter coefficients• K+1: FIR filter length
Transfer Function– 1
0 1
K
KY z b X z b z X z b z X z
Y–
1
0 1
K
K
Y zH z b b z b z
X z
Ch7. Finite Impulse Response Filter Design 2
FIR Filter Format (2)FIR Filter Format (2)
Ex 7.1 Given the following FIR filter:Ex 7.1 Given the following FIR filter:
Y(n)=0.1x(n)+0.25x(n-1)+0.2x(n-2)Determine the transfer function filter length nonzero Determine the transfer function, filter length, nonzero coefficients, and impulse response.
Properties from FIR filter format Properties from FIR filter format– All the poles are at the origin STABLE– Operations includep
• Multiplying the filter inputs by the corresponding filter coefficients and accumulating them
Ch7. Finite Impulse Response Filter Design 3
Fourier Transform DesignIdeal Low Pass Filter (1)Ideal Low Pass Filter (1)
Frequency Response
– 1,0,
cjH e
0, c
Ch7. Finite Impulse Response Filter Design 4
Fourier Transform DesignIdeal Low Pass Filter (1)
Periodicity of the ideal lowpass frequency
Ideal Low Pass Filter (1)
response
Ch7. Finite Impulse Response Filter Design 5
Fourier Transform DesignImpulse Response (1)Impulse Response (1)
Discrete-time Fourier Transform
– 12
j j nx n X e e d
– j j n
n
X e x n e
Impulse response of the ideal lowpass filter
– 1 1 for 2 2
cj j n j nh n H e e d e d n
2 2
c
, 0c n
– sin
, 0c
h nn
nn
Ch7. Finite Impulse Response Filter Design 6
Fourier Transform DesignImpulse Response (2)Impulse Response (2)
– Plot
– Theoretically h(n) exists for -∞<n<∞ and is symmetrical about n=0. (h(n) = h(-n))
– As n increases, |h(n)| decreases.As n increases, |h(n)| decreases.
Ch7. Finite Impulse Response Filter Design 7
Fourier Transform DesignCausal FIR Filter (1)Causal FIR Filter (1)
Infinite length of filter coefficients– Truncated for FIR filter–N l
11 0 1M MH z h M z h z h h z h M z Noncausal
Causal FIR FilterDelay the truncated impulse response h(n) by M – Delay the truncated impulse response h(n) by M samples
– 1 20 1 2
MMH z b b z b z
for 0,1, , 2nb h n M n M
Ch7. Finite Impulse Response Filter Design 8
Fourier Transform DesignCausal FIR Filter (2)Causal FIR Filter (2)
Ch7. Finite Impulse Response Filter Design 9
Fourier Transform DesignExample 7 2 (1)Example 7.2 (1)
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 the Fourier transform methodFourier transform method.
b. Determine the transfer function and difference equation of the designed FIR systemequation of the designed FIR system
c. Compute and plot the magnitude frequency response for Ω = 0, π/4, π/2, 3π/4, and πresponse for Ω 0, π/4, π/2, 3π/4, and πradians.
Ch7. Finite Impulse Response Filter Design 10
Fourier Transform DesignExample 7 2 (2)Example 7.2 (2)
Ch7. Finite Impulse Response Filter Design 11
Fourier Transform DesignExample 7 2 (3)Example 7.2 (3)
Ch7. Finite Impulse Response Filter Design 12
Fourier Transform DesignExample 7 2 (4)Example 7.2 (4)
Ch7. Finite Impulse Response Filter Design 13
Fourier Transform DesignObservationsObservations
Gibbs effect– The oscillations exhibited in the passband (main lobe)
and stop band (side lobes) of the magnitude frequency responseresponse
– Originates from the abrupt truncation of the infinite impulse response
– Window functions will be used to remedy the problem
A large number of the filter coefficientsSh ll ff h t i ti f th t iti b d– Sharp roll-off characteristics of the transition band
– Increased time delay and increased computational complexity for implementing the designed FIR filter.p y p g g
The phase response is linear in the passband– Symmetrical coefficients (odd number)
Ch7. Finite Impulse Response Filter Design 14
Ch7. Finite Impulse Response Filter Design 15
Ch7. Finite Impulse Response Filter Design 16
Ch7. Finite Impulse Response Filter Design 17
Window MethodIntroductionIntroduction
Fourier transform design with window functions– Remedy the undesirable Gibbs oscillations in the
passband and stopband of the designed FIR filterGradually weight the designed FIR coefficients down to – Gradually weight the designed FIR coefficients down to zeros at both ends for the range of -M≤n≤M
FIR filter coefficients– hw(n) = h(n)w(n)
• w(n): window function• h(n): ideal impulse response
Ch7. Finite Impulse Response Filter Design 18
Window MethodWindow function (1)Window function (1)
Rectangular window( ) 1 M≤ ≤M (7 15)– wrec(n) = 1, -M≤n≤M (7.15)
Triangular (Bartlett) window
– (7.16)
Hanning window
1 , tri
nw n M n M
M
Hanning window
– (7.17)
Hamming window
0.5 0.5cos , han
nw n M n M
M
Hamming window
– (7.18) 0.54 0.46 cos , ham
nw n M n M
M
Blackman window
– (7.19) 20.42 0.5 cos 0.08 cos , black
n nw n M n M
M M
Ch7. Finite Impulse Response Filter Design 19
M M
Window MethodWindow function (2)Window function (2)
Ch7. Finite Impulse Response Filter Design 20
Window MethodExample 7 4 (1)Example 7.4 (1)
Given the calculated filter coefficientsh(0)=0.25, h(-1)=h(1)=0.22508, h(-2)=h(2)=0.15915,
h(-3)=h(3)=0.007503( ) ( )
a. Apply the Hamming window function to obtain windowed coefficients hw(n).
b Plot the impulse response h(n) and windowed impulse b. Plot the impulse response h(n) and windowed impulse response hw(n).
Ch7. Finite Impulse Response Filter Design 21
Window MethodExample 7 4 (2)Example 7.4 (2)
Ch7. Finite Impulse Response Filter Design 22
Window MethodDesign procedureDesign procedure
1. Obtain the FIR filter coefficients h(n) via the Fourier transform method (Table 7.1)
2. Multiply the generated FIR filter coefficients by h l d i d the selected window sequence
where w(n) is chosen to be one of the window functions listed in , , ,0,1, , ,wh n h n w n n M M where w(n) is chosen to be one of the window functions listed in eqs. (7.15) to (7.19) in page 22.
3. Delay the windowed impulse sequence hw(n) by M l t t th i d d FIR filt M samples to get the windowed FIR filter coefficients:
, 0, 1, , 2n wb h n M n M
Ch7. Finite Impulse Response Filter Design 23
Window MethodExample 7 5 (1)Example 7.5 (1)
a. Design a 3-tap FIR lowpass filter with a cutoff frequency of 800 Hz and a sampling rate of 8,000 Hz using the Hamming window function.
b. Determine the transfer function and difference equation of the designed FIR systemequation of the designed FIR system.
C t d l t th it d f c. Compute and plot the magnitude frequency response for Ω=0, π/4, π/2, 3π/4, and π radians.
Ch7. Finite Impulse Response Filter Design 24
Window MethodExample 7 5 (2)Example 7.5 (2)
Ch7. Finite Impulse Response Filter Design 25
Window MethodExample 7 5 (3)Example 7.5 (3)
Ch7. Finite Impulse Response Filter Design 26
Window MethodE l 7 6Example 7.6
a. Determine a 5-tap FIR band reject filter with a lower cutoff frequency of 2,000 Hz, an upper frequency of 2,400 Hz, and a sampling rate of 8 000 Hz using the Hamming window function8,000 Hz using the Hamming window function.
b Determine the transfer functionb. Determine the transfer function.
Ch7. Finite Impulse Response Filter Design 27
Window MethodComparison of magnitude frequency responsesComparison of magnitude frequency responses
Ch7. Finite Impulse Response Filter Design 28
Window MethodHow to choose a window? (1)How to choose a window? (1)
Specifications: – Fig. 7.14– Table 7.7 FIR filter length estimation
; normalized transition widthstop pass
s
f ff
f
Filter length for Hamming window: N=3.3/Δf Passband ripple
dB 20l 1 –
Stopband attenuation 10 dB = 20log 1p p
dB 20log –
Cut-off frequency– f = (f + f )/2
10 dB = 20logs s
Ch7. Finite Impulse Response Filter Design 29
– fc = (fpass + fstop)/2
Window MethodH t h i d ? (2)How to choose a window? (2)
Ch7. Finite Impulse Response Filter Design 30
Window MethodHow to choose a window? (3)How to choose a window? (3)
Ch7. Finite Impulse Response Filter Design 31
Window MethodExample (1)Example (1)
Ex. A bandpass filter must be designed according to the following specifications:passband 150 – 250 Hztransition width 50 Hzpassband ripple 0.1 dBstopband attenuation 60 dBsampling frequency 1 kHz
32
Window MethodExample (2)
a) Specify the desired frequency response of filter, (H ( ))
Example (2)
(HD(ω)).b) Obtain hD[n].c) Find all the window functions which satisfy the given c) Find all the window functions which satisfy the given
specifications from the following table.d) Find the required value for N to use each window
f ti f th lt f ( )function from the results of (c).e) Mention the window function having the smallest value
of N, and find h(0) for the window function., ( )
Ch7. Finite Impulse Response Filter Design 33