Chapter 10 - Part 1
Chapter 10 - Part 1
Chapter 10 - Part 1
Mohammed Abdel-Hafez
Department of Electrical Engineering
Lecture Outline
Proakis: Chapter 10, sections 10.1 and 10.2
(US Edition).
Part 1 Design of FIR Filters
Introduction
Linear Phase
Ideal Filters
FIR filters design using Widowing
δ1 : Passband ripple
δ2 : Stopband ripple
passband
tolerance
3dB cutoff
frequency
1/ 2
stopband
tolerance monotonous descent
passband cc
stopband
cutoff cutoff
frequency frequency
11/17/2020 38
ELEC 604, M. hafez
relative specifications:maximum magnitude in
passband is normalized to 1, viz. 0dB
𝐴𝑝 = −20 ∗ log10 ( 1 − 𝛿1 ) > 0 maximum attenuation in passband
𝐴𝑠 = −20 ∗ log10 𝛿2 > 0 minimum attenuation in stopband
𝛿𝑝 = 𝛿1 : 𝑝𝑎𝑠𝑠𝑏𝑎𝑛𝑑 𝑟𝑖𝑝𝑝𝑙𝑒
3dB cutoff frequency: 𝛿𝑠 = 𝛿2 : stopband ripple
j c
| H (e ) |= 1 / 2
j c
− 20 log10 | H (e ) |= 3dB
magnitude response of equivalent analog system:
j
H ( e ) | = T | |
H eff ( j ) = T
0 | |
T
digital specification, finally: p = pT , s = sT
11/17/2020 ELEC 604, M. hafez 39
Filter Specification
Lowpass (a) Highpass (b) Bandpass (c) Bandstop (d)
Specification • Up or down passband cutoff • up and down passband cutoff
frequency. frequency.
• Up or down stopband cutoff • up and down stopband cutoff
frequency. frequency.
𝛿𝑝 = 𝛿1 : 𝑝𝑎𝑠𝑠𝑏𝑎𝑛𝑑 𝑟𝑖𝑝𝑝𝑙𝑒
𝛿𝑠 = 𝛿2 : stopband ripple
𝑀−1
Delay 𝜏 = We choose 𝑀 odd integer
2
Gain, dB
Gain, dB
-50 -50
-100 -100
-50
>> filterbuilder
-100 in matlab
0 0.2 0.4 0.6 0.8 1
/
j 1 e − j
, || c
H d (e ) =
0, c ||
1 c c sin[c (n − )]
e d =
j − j j n
hd (n) = F H d (e ) =
−1
e
2 − c c ( n − )
c sin c (n − )
, 0 n M −1
h( n) = c (n − )
0, otherwise
M −1
W (e j ) = w(n)e − jn
n =0
𝑀−1 𝜔𝑀
𝑀−1 sin 𝑀−1
𝑊𝑅 (𝑒 𝑗𝜔
)= 𝑒 −𝑗𝜔𝑛
= 𝑒
−𝑗𝜔 2 2 = 𝑊 (𝜔)𝑒 −𝑗𝜔 2
𝜔 𝑅
𝑛=0 sin
2
𝜔𝑀
sin
𝑊𝑅 (𝜔) = 2
𝜔
sin
2
11/17/2020 ELEC 604, M. hafez 57
Window Design Techniques
➢ The conclusion
⚫ Since the window w(n) has a finite length equal to M, its
response has a peaky main lobe whose width is
proportional to 1/M, and has side lobes of smaller heights.
⚫ The periodic convolution produces a smeared version of
the ideal response H d (e j )
j
⚫ The main lobe produces a transition band in H (e )
whose width is responsible for the transition width. This
width is then proportional to 1/M. The wider the main lobe,
the wider will be the transition width.
⚫ The side lobes produces ripples that have similar shapes
in both the passband and stopband.
𝑀𝜔
sin
𝑊𝑅 (𝜔) = 2
𝜔
sin
2
4𝜋
The width of main lobe is:
𝑀
11/17/2020 ELEC 604, M. hafez 59
Window Design Techniques
➢ Gibbs phenomenon
The truncation of the infinite length hd (n) will
introduce ripples in frequency response H ( ) .
The oscillatory behavior near the band edge of the
filter is called the Gibbs phenomenon.
2n M −1
, 0n
w(n) = M −1 2
2n M −1
2 − , n M −1
M −1 2
2
𝑀𝜔
2 sin 𝑀−1
𝑗𝜔
𝑊(𝑒 ) ≈ 4 𝑒
−𝑗 2 𝜔, (𝑀 >> 1, 𝑀 − 1 ≈ 𝑀)
𝑀 sin 𝜔
2
1 2π n
w(n) = 1 − cos
2 M − 1
2𝜋 2𝜋
𝑊 𝜔 ≈ 0.5𝑊𝑅 𝜔 + 0.25 𝑊𝑅 𝜔− + 𝑊𝑅 𝜔 + (𝑀 >> 1)
𝑀 𝑀
2π n
w(n) = 0.54 − 0.46 cos
M − 1
2𝜋 2𝜋
𝑊 𝜔 ≈ 0.54𝑊𝑅 𝜔 + 0.23 𝑊𝑅 𝜔− + 𝑊𝑅 𝜔 + (𝑀 >> 1)
𝑀 𝑀
8
The width of main lobe is:
M
2π n 4π n
w(n) = 0.42 − 0.5 cos + 0.08 cos
M −1 M − 1
2𝜋 2𝜋
𝑊(𝜔) ≈ 0.42𝑊𝑅 (𝜔) + 0.25 𝑊𝑅 𝜔 − + 𝑊𝑅 𝜔 +
𝑀 𝑀
4𝜋 4𝜋
+0.04 𝑊𝑅 𝜔 − + 𝑊𝑅 𝜔 + (𝑀 >> 1)
𝑀 𝑀
12𝜋
The width of main lobe is:
𝑀
11/17/2020 ELEC 604, M. hafez 64
Window Design Techniques
➢ Kaiser window
This is one of the most useful and optimum windows.
2n
2
I 0 1 − 1 −
M −1
w(n) =
I 0 ( )
= 0 → rectangular window
= 5.44 → Hamming window
= 8.5 → Blackman window
11/17/2020 ELEC 604, M. hafez 65
Window Design Techniques
The design equations for Kaiser window
Given 𝜔𝑝 , 𝜔𝑠 , 𝑅𝑝 , 𝐴𝑠
𝑅𝑝 : maximum attenuation in passband (Ripple)
𝐴𝑠 : minimum attenuation in stopband
The norm transition width: = s − p
As − 7.95
The filter order M: M
2.286
Example
Design a digital FIR lowpass filter:
− j
j e , | | c e − j
, | | 0.3
H d (e ) = =
0, c | | 0, 0.3 | |
sin[0.3 (n − 16)]
hd (n) =
(n − 16)
h(n) = hd (n) w(n)
sin[0.3 (n − 16)] π n
= 0.54 − 0.46 cos rect (n,33)
(n − 16) 16
0.25
0.2
0.15
0.1
clear
0.05
clc
0
M=33;
-0.05
n=0:1:M;
-0.1
0 5 10 15 20 25 30 35
tau=(M)/2;
h=0.3*sinc(0.3*(n-tau)).*(0.54-0.46*cos(pi*n/tau));
stem(n,h)
0
0 c
0 c
1
j j n
hd (n) = H ( e )e d
2 −
1 −c j ( n − ) j ( n − )
2 − c
= e d + e d
sin[ (n − )] sin[c (n − )]
= −
(n − ) (n − )
11/17/2020 ELEC 604, M. hafez 76
Digital FIR highpass filter
Example
s = 0.4 , As = 60 dB
Design a digital FIR highpass filter :
p = 0.6 , R p = 0.5 dB
Solution:
➢ Compute the digital frequencies
s = 0.4 , p = 0.6
p + s
c = = 0.5 , = p − s = 0.2
2
sin[ (n − )] sin[c (n − )]
hd (n) = −
(n − ) (n − )
sin[ (n − 27)] sin[0.5 (n − 27)]
= −
(n − 27) (n − 27)
11/17/2020 ELEC 604, M. hafez 78
Solution
➢ Compute the impulse response of the designed filter
2π n 4π n
w(n) = 0.42 − 0.5 cos + 0.08 cos rect (n, M )
M −1 M − 1
2π n 4π n
= 0.42 − 0.5 cos + 0.08 cos rect (n,55)
54 54
0 c2
0 c1 c2
0 c
− j
j e , c1 | | c 2
H d (e ) =
0, otherwise
Solution:
➢ Compute the digital frequencies
p1 + s1 p 2 + s 2
c1 = = 0.275 , c 2 = = 0.725
2 2
= min[( p1 − s1 ), (s 2 − p 2 )] = 0.15
As = 60 dB Blackman
11𝜋 74 − 1
∵ Δ𝜔 = = 0.15𝜋, ∴ 𝑀 = 73, 𝜏= = 36
𝑀 2
➢ Derive the impulse response of ideal FIR bandpass filter
sin[c 2 (n − )] sin[c1 (n − )]
hd (n) = −
(n − ) (n − )
sin[0.725 (n − 36.5)] sin[0.275 (n − 36.5)]
= −
(n − 36.5) (n − 36.5)
2π n 4π n
w(n) = 0.42 − 0.5 cos + 0.08 cos rect (n, M )
M −1 M − 1
2π n 4π n
= 0.42 − 0.5 cos + 0.08 cos rect (n,74)
73 73
0
0 c1 c2
0 c2
0 c1
11/17/2020 ELEC 604, M. hafez 87
Digital FIR bandstop filter
The frequency response of an ideal FIR bandpass filters
− j
j e , 0 | | c1 , c 2 | |
H d (e ) =
0, otherwise
The impulse response of an ideal FIR highpass filters
1
j j n
hd (n) = H ( e )e d
2 −
1 −c 2 j ( n − ) c1 j ( n − ) j ( n − )
2 − −c1 c 2
= e d + e d + e d
sin[ (n − )] sin[c 2 (n − )] sin[c1 (n − )]
= − +
(n − ) (n − ) (n − )
11/17/2020 ELEC 604, M. hafez 88
Digital FIR bandstop filter
Example
Design a digital FIR bandstop filter:
p1 = 0.3 , R p1 = 0.5 dB s 2 = 0.6 , As 2 = 40 dB
s1 = 0.4 , As1 = 40 dB p 2 = 0.7 , R p 2 = 0.5 dB
Solution:
➢ Compute the digital frequencies
p1 + s1 p 2 + s 2
c1 = = 0.35 , c 2 = = 0.65
2 2
= min[(s1 − p1 ), ( p 2 − s 2 )] = 0.1
As = 40 dB Hanning
6.2 63 − 1
= = 0.1 , M ' = 62, M = 63 = = 31
M' 2
Note: the M must be odd for FIR bandstop filters
1 2π n
w(n) = 1 − cos rect (n, M )
2 N − 1
1 2π n
= 1 − cos rect (n,63)
2 62
10.1 to 10.10