7 FIR filter
7 FIR filter
windowing method
1
4 basic types of generalized linear phase
FIR filters
2
4 basic types of generalized linear phase
FIR filters
3
4 basic types of generalized linear phase
FIR filters
4
4 basic types of linear phase FIR filters
h1= [0.5, 1, 1, 1, 1, 1, 0.5]; % FIR 1
h2= [0.5, 1, 1, 1, 1, 1, 1, 0.5]; % FIR 2
h3= [0.5, 1, 1, 0, -1, -1, -0.5] ; %FIR 3
h4= [0.5, 1, 1, -1, -1, -0.5]; % FIR 4
figure
% Plot the magnitude and phase responses
% in angular frequency from 0 to pi
subplot(121); plot(w/pi, abs(H1));grid; ylabel('FIR 1')
subplot(122); plot(w/pi, unwrap(angle(H1)));grid;
figure
%Plot the zero - pole plots
figure
zplane(h1,1); grid
title('FIR 1')
5
Ideal filters
6
Ideal lowpass FIR filter
ℎ𝑑 𝑛
Inverse DTFT
1, 𝜔 ≤ 𝜔𝑐 sin(𝜔𝑐 𝑛)
𝐻𝑑 𝑒 𝑗𝜔 =ቊ ℎ𝑑 𝑛 =
0 𝜔𝑐 < 𝜔 ≤ 𝜋 𝜋𝑛
8
Design of FIR filters by windowing
ℎ𝑑 𝑛
9
Design of FIR filters by windowing
The DTFT of the product of two sequences is
DTFT 1
𝑎 𝑛 = 𝑥 𝑛 𝑤[𝑛] 𝐴(𝑒 𝑗𝜔 ) = න 𝑋 𝑒 𝑗𝜃 𝑊 𝑒 𝑗 𝜔−𝜃
𝑑𝜃
2𝜋 2𝜋
10
Example
11
Actual frequency response and Filter
specifications
Absolute specifications
➢ 0 ≤ 𝜔 ≤ 𝜔𝑝
1 − 𝛿𝑝 ≤ 𝐻 𝑒 𝑗𝜔 ≤ 1 + 𝛿𝑝
➢ 𝜔𝑠 ≤ 𝜔 ≤ 𝜋
𝐻 𝑒 𝑗𝜔 ≤ 𝛿𝑠
Relative specifications
1 + 𝛿𝑝
𝐴𝑝 = 20 log10
1 − 𝛿𝑝
1 + 𝛿𝑝
𝐴𝑠 = 20 log10 ≈ −20 log10 𝛿𝑠
𝛿𝑠
12
Window functions
13
Window functions
14
Properties of commonly used windows
𝐿 =𝑀+1
15
Design of FIR filters by windowing
𝑀 𝑀
where 𝑛 = (− : )
2 2
16
Design of FIR filters by windowing
6. Compute the impulse response ℎ 𝑛 = ℎ𝑑 𝑛 𝑤[𝑛] using the chosen window
7. Check whether the designed filter satisfies the prescribed specifications; if
not, increase the order 𝑀 and go back to step 5.
17
Design of FIR filters by windowing
1 + 𝛿𝑝
𝐴𝑝 = 20 log10
1 − 𝛿𝑝
18
Design of FIR filters by windowing
19
Design of FIR filters by windowing
20
Design of FIR filters by windowing
• Example:
21
Design of FIR filters by windowing
• A bandpass filter
DTFT
1
ℎ 𝑘 𝑐𝑜𝑠𝜔𝑚 𝑘 ↔ 2
[𝐻(𝑒 𝑗 𝜔−𝜔𝑚 + 𝐻(𝑒 𝑗 𝜔+𝜔𝑚 ]
22
Design of FIR filters by windowing
23
Filter design using the adjustable
Kaiser window
2
𝑛−𝛼
𝐼𝑂 𝛽 1 − 𝑥 𝑚
𝛼 ∞
𝑤𝑛 = 2
, 0≤𝑛≤𝑀 𝐼𝑂 𝑥 = 1 +
𝐼𝑂 𝛽 𝑚!
𝑚=1
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
0, 𝐴 < 21
𝛽 = ቐ0.5842 𝐴 − 21 0.4 + 0.07886 𝐴 − 21 , 21 ≤ 𝐴 ≤ 50
0.1102 𝐴 − 8.7 , 𝐴 > 50
𝐴−8
𝑀=
2.285∆𝜔
24
Filter design using the adjustable
Kaiser window
𝑀 = 20
𝛽=5
25
Filter design using the adjustable
Kaiser window
1. Given the design specifications 𝜔𝑝 , 𝜔𝑠 , 𝐴𝑝 , 𝐴𝑠 , determine the ripples 𝛿𝑝
and 𝛿𝑠 and set 𝛿 = min{𝛿𝑝 , 𝛿𝑠 }
2. Determine the cutoff frequency of the ideal lowpass prototype by
𝜔𝑐 = (𝜔𝑝 + 𝜔𝑠 )/2
3. Determine the design parameters 𝐴 = −20 log10 𝛿 and ∆𝜔 = 𝜔𝑠 − 𝜔𝑝
4. Determine the required values of 𝛽 and 𝑀. If 𝑀 is odd, we may increase it
by one.
5. Determine the impulse response of the ideal lowpass filter by
sin[𝜔𝑐 (𝑛)]
ℎ𝑑 𝑛 =
𝜋(𝑛)
𝑀 𝑀
where 𝑛 = (− : )
2 2
26
Filter design using the adjustable
Kaiser window
6. Compute the impulse response ℎ 𝑛 = ℎ𝑑 𝑛 𝑤[𝑛] using the Kaiser window
7. Check whether the designed filter satisfies the prescribed specifications; if
not, increase the order 𝑀 and go back to step 5.
27
Filter design using the adjustable
Kaiser window
• Consider the lowpass linear-phase FIR filter specifications
28
Highpass, bandpass…
• https://www.allaboutcircuits.com/technical-articles/design-examples-
of-fir-filters-using-window-method/
29
Discrete-time frequency transformations
𝑤 −1 = 𝐺(𝑧 −1 )
𝐻 𝑧 = 𝐻𝑙𝑝 𝑤 ቚ
𝑤 −1 =𝐺(𝑧 −1 )
30
Discrete-time frequency transformations
32
Task 3
33
Matlab implementation
• fdatool
34