Вы находитесь на странице: 1из 33

FIR Filt

Filter D
Design
i

1 Finite Impulse Response Filter Format


1.Finite

2.Fourier Transform Design

3.Window Method
FIR Filter Format (1)
 Input-output relationship
K

– y ( n)   b x  n  i   b x  n   b x  n  1    b x  n  K 
i 0 1 K
i 0

• bi: FIR filter


filt coefficients
ffi i t
• K+1: FIR filter length

 Transfer Function
– Y  z   b0 X  z   b1 z X  z     bK z X  z 
1 K

Y z
– H z 
1 K
 b0  b1 z    bK z
X z

Ch7. Finite Impulse Response Filter Design 2


FIR Filter Format (2)

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,
function filter length,
length nonzero
coefficients, and impulse response.

 Properties from FIR filter format


– All the poles are at the origin  STABLE
p
– Operations include
• Multiplying the filter inputs by the corresponding filter coefficients
and accumulating them

Ch7. Finite Impulse Response Filter Design 3


Fourier Transform Design
Ideal Low Pass Filter (1)

 Frequency Response
1,   c
– H e   
j

0, c    

Ch7. Finite Impulse Response Filter Design 4


Fourier Transform Design
Ideal Low Pass Filter (1)

 Periodicity of the ideal lowpass frequency


response

Ch7. Finite Impulse Response Filter Design 5


Fourier Transform Design
Impulse Response (1)

 Discrete-time Fourier Transform



X  e j  e jn d 
1
–  
x n  
2 

– X e    x  n e
j  jn

n 

 Impulse response of the ideal lowpass filter


 c

– h  n 
1
2  H  e j
 e jn
d  
1
2  e jn d  for    n  
 c

 c
 , n0

– h  n  
 sin  c n  , n  0
  n

Ch7. Finite Impulse Response Filter Design 6


Fourier Transform Design
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.

Ch7. Finite Impulse Response Filter Design 7


Fourier Transform Design
Causal FIR Filter (1)

 Infinite length of filter coefficients


– Truncated for FIR filter
– H  z   h  M  z M    h 1 z  h  0   h 1 z 1    h  M  z  M
 Noncausal
N l
 Causal FIR Filter
– Delay the truncated impulse response h(n) by M
samples
– H  z   b0  b1 z 1    b2 M z 2 M
bn  h  n  M  for n  0,1,  , 2M

Ch7. Finite Impulse Response Filter Design 8


Fourier Transform Design
Causal FIR Filter (2)

Ch7. Finite Impulse Response Filter Design 9


Fourier Transform Design
Example 7
7.2
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 method.
method
b. Determine the transfer function and difference
equation of the designed FIR system
c. Compute and plot the magnitude frequency
response for Ω = 0, π/4, π/2, 3π/4, and π
radians.

Ch7. Finite Impulse Response Filter Design 10


Fourier Transform Design
Example 7
7.2
2 (2)

Ch7. Finite Impulse Response Filter Design 11


Fourier Transform Design
Example 7
7.2
2 (3)

Ch7. Finite Impulse Response Filter Design 12


Fourier Transform Design
Example 7
7.2
2 (4)

Ch7. Finite Impulse Response Filter Design 13


Fourier Transform Design
Observations

 Gibbs effect
– The oscillations exhibited in the passband (main lobe)
and stop band (side lobes) of the magnitude frequency
response
– 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 coefficients
– Sh
Sharp roll-off
ll ff characteristics
h t i ti off th
the transition
t iti band
b d
– Increased time delay and increased computational
complexity
p y for implementing
p g the designed
g FIR filter.
 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 Method
Introduction

 Fourier transform design with window functions


– Remedy the undesirable Gibbs oscillations in the
passband and stopband of the designed FIR filter
– 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 Method
Window function (1)
 Rectangular window
– wrec(n)
( ) = 1,
1 -M≤n≤M
M≤ ≤M (7 15)
(7.15)

 Triangular (Bartlett) window


n
– wtri  n   1  , M n M (7.16)
M
 Hanning window
 n 
– whan  n   0.5  0.5 cos  ,  M  n  M (7.17)
M 
 Hamming window
 n 
– wham  n   0.54  0.46 cos  ,  M  n  M (7.18)
M 
 Blackman window
 n   2 n 
– wblack  n   0.42  0.5 cos    0.08 cos  ,  M  n  M (7.19)
M   M 

Ch7. Finite Impulse Response Filter Design 19


Window Method
Window function (2)

Ch7. Finite Impulse Response Filter Design 20


Window Method
Example 7
7.4
4 (1)
 Given the calculated filter coefficients
h(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
response hw(n).

Ch7. Finite Impulse Response Filter Design 21


Window Method
Example 7
7.4
4 (2)

Ch7. Finite Impulse Response Filter Design 22


Window Method
Design 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
the
h selected
l d window
i d sequence
 hw  n   h  n  w  n  , n   M ,  , 0,1,  , 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 samplesl to
t gett the
th windowed
i d d FIR filter
filt
coefficients:
bn  hw  n  M  , n  0, 1,  , 2 M

Ch7. Finite Impulse Response Filter Design 23


Window Method
Example 7
7.5
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 system.
system

c. C
Compute
t and d plot
l t th
the magnitude
it d frequency
f
response for Ω=0, π/4, π/2, 3π/4, and π radians.

Ch7. Finite Impulse Response Filter Design 24


Window Method
Example 7
7.5
5 (2)

Ch7. Finite Impulse Response Filter Design 25


Window Method
Example 7
7.5
5 (3)

Ch7. Finite Impulse Response Filter Design 26


Window Method
E
Example
l 7.6
76
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 function.
8,000 function

b Determine the transfer function


b. function.

Ch7. Finite Impulse Response Filter Design 27


Window Method
Comparison of magnitude frequency responses

Ch7. Finite Impulse Response Filter Design 28


Window Method
How to choose a window? (1)
 Specifications:
– Fig. 7.14
– Table 7.7 FIR filter length estimation
f stop  f pass
 f  ; normalized transition width
fs

 Filter length for Hamming window: N=3.3/Δf


 Passband ripple
20log10 1   p 
–  p dB = 20l
 Stopband attenuation
–  s dB =  20log10  s 
 Cut-off frequency
– fc = (fpass + fstop)/2
Ch7. Finite Impulse Response Filter Design 29
Window Method
H
How tto choose
h a window?
i d ? (2)

Ch7. Finite Impulse Response Filter Design 30


Window Method
How to choose a window? (3)

Ch7. Finite Impulse Response Filter Design 31


Window Method
Example (1)

Ex. A bandpass filter must be designed according to


the following specifications:
passband 150 – 250 Hz
transition width 50 Hz
passband ripple 0.1 dB
stopband attenuation 60 dB
sampling frequency 1 kHz

32
Window Method
Example (2)
a) Specify the desired frequency response of filter,
(HD(ω)).
( ))
b) Obtain hD[n].
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
function
ti from
f the
th results
lt off (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

Вам также может понравиться