Design of FIR Filtersa The Filter Design Problem b FIR Filters with Linear Phase c Design of FIR Filter by Windowing d Design of FIR Filter by Frequency Sampling e Chebyshev Polynomials
Trang 1Nguyễn Công Phương
PHYSIOLOGICAL SIGNAL PROCESSING
Discrete Filters
Trang 2I Introduction
II Introduction to Electrophysiology
III Signals and Systems
IV Fourier Analysis
V Signal Sampling and Reconstruction
VI The z-Transform
Trang 3Discrete Filters
1 Types of Filters
2 Transfer Function and Frequency Response
3 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 4Types of Filters (1)
http://reactivex.io/documentation/operators/filter.html
Trang 5Types of Filters (2)
FILTER
Trang 73 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 8=
( ) ( )
Trang 9Transfer Function (2)
System
( ) ( )
Trang 10( )
M
k k k N
k k k
Trang 13Consider a system function
Find its corresponding difference equation?
1
2
1 2
( ) [ ] ( ) [ ]
Trang 153 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 16=
( ) ( )
H j
H j
ω ω
∠
Trang 17Frequency Response (1)
System
( ) ( )
H j
H j
ω ω
ω
=
Trang 18( ) 2
cos
Trang 20Frequency Response (4)
10 o
20 log ( ) 0.3 ( ) 207
dB
H j
ω ω
Trang 21Frequency Response (5)
0.015 o
/ 2 10 0.9661
0 207
Y Y
Y Y
Trang 22Frequency Response (6)
10 o
20 log ( ) 5.9 ( ) 345
dB
H j
ω ω
Trang 23Frequency Response (7)
0.295 o
/ 2 10 0.5070
0 345
Y Y
Y Y
ω
=
Trang 26Discrete Filters
1 Types of Filters
2 Transfer Function and Frequency Response
3 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 27Group Delay and Inverse System
j phase delay
dx
H e d
Trang 28Group Delay and Inverse System
Trang 29Group Delay and Inverse System
(3)
An LTI system H(z) with input x[n] and output y[n] is said to be invertible
if we can uniquely determine x[n] from y[n]
[ ] * inv [ ] [ ]
h n h n = δ n
1 ( ) inv ( )
( )
M
k k k
N
k k k
Trang 30Discrete Filters
1 Types of Filters
2 Transfer Function and Frequency Response
3 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 31Minimum and Linear Phase
Filters (1)
• A causal and stable system H(z) with a causal and stable inverse H inv (z) is known as a
• H (z) is minimum – phase if both its poles &
zeros are inside the unit circle.
Trang 32Minimum and Linear Phase
We can obtain the minimum – phase system by replacing each factor (1 + az–1)
(|a| > 1), by a factor of the form a(1 + a–1z–1)
Trang 33Minimum and Linear Phase
mix mix max
- 0.5 0 0.5 1 1.5
0 5 1
Trang 34Minimum and Linear Phase
mix mix max
Trang 35Minimum and Linear Phase
Trang 36Minimum and Linear Phase
Trang 37Minimum and Linear Phase
Trang 38Discrete Filters
1 Types of Filters
2 Transfer Function and Frequency Response
3 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters
Trang 39Design of FIR Filters
00
( )
1
k k
k k
Trang 40Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling e) Chebyshev Polynomials & Minimax
Trang 41The Filter Design Problem (1)
1
Filter Spec trum of input s ignal #2
0.2 0.2002 0.2004 0.2006 0.2008 0.201 0.2012 0.2014 0.2016 0.2018 0.202
Time
-2 -1 0 1
Spec trum of output s ignal #2
Trang 42The Filter Design Problem (2)
1
Filter #2 Spec trum of input s ignal
0.2 0.2002 0.2004 0.2006 0.2008 0.201 0.2012 0.2014 0.2016 0.2018 0.202
Time
-2 -1 0 1
Spec trum of output s ignal #2
Trang 43The Filter Design Problem (3)
1
Filter #2 Spec trum of input s ignal
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/
0 0.5
Output s ignal #2
Trang 44The Filter Design Problem (4)
1
Filter #2 Spec trum of input s ignal
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/
0 0.5
Output s ignal #2
Trang 45The Filter Design Problem (5)
Trang 46The Filter Design Problem (6)
1 2
Trang 47The Filter Design Problem (7)
Trang 48The Filter Design Problem (8)
2 2
Trang 49The Filter Design Problem (9)
Trang 50Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling e) Chebyshev Polynomials & Minimax
Trang 51FIR Filters with Linear Phase (1)
[ ]
c lp
= 6.5
-0.1 0 0.1 0.2 0.3 0.4
Trang 52FIR Filters with Linear Phase (2)
Trang 53FIR Filters with Linear Phase
Trang 54FIR Filters with Linear Phase
Trang 55FIR Filters with Linear Phase
Trang 56FIR Filters with Linear Phase
Trang 57FIR Filters with Linear Phase
Trang 58FIR Filters with Linear Phase
Trang 59FIR Filters with Linear Phase
2
M j
2 1
Trang 60FIR Filters with Linear Phase
Trang 61FIR Filters with Linear Phase
Trang 62FIR Filters with Linear Phase
Trang 63FIR Filters with Linear Phase
M j
2 1
Trang 64FIR Filters with Linear Phase
Trang 65FIR Filters with Linear Phase
Trang 66FIR Filters with Linear Phase
( ) sin [ ]cos
2
M j
2 1
Trang 67FIR Filters with Linear Phase
Trang 68FIR Filters with Linear Phase
Trang 69FIR Filters with Linear Phase (9)
Trang 70FIR Filters with Linear Phase
(10)
( ) 0
1 [ ]cos
1 [ ]sin
Trang 71FIR Filters with Linear Phase
(11)
( ) 0
Trang 72FIR Filters with Linear Phase
ω
sin ω
sin 2
ω
Uses
LP, HP, BP, BS multiband filters
LP, BP
Differentiators, Hilbert transformers
Differentiators, Hilbert transformers
Trang 73FIR Filters with Linear Phase
Trang 74FIR Filters with Linear Phase
Trang 75Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
i Direct Truncation of an Ideal Impulse Response
ii Smoothing the Frequency Response Using Fixed
Windows iii Filter Design Using the Adjustable Kaiser Window
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design g) Design of Some Special FIR Filters
Trang 77sin( / 2) 1
j M M
j n
Trang 79Direct Truncation of
an Ideal Impulse Response (4)
ω π
Trang 81Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
i Direct Truncation of an Ideal Impulse Response
ii Smoothing the Frequency Response Using Fixed
Windows
iii Filter Design Using the Adjustable Kaiser Window
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design g) Design of Some Special FIR Filters
Trang 82Smoothing the Frequency Response
Using Fixed Windows (1)
2 / , 0 / 2, [ ] 2 2 / , / 2
0, 5 0,5 cos(2 / ), 0 [ ]
Trang 83Smoothing the Frequency Response
Using Fixed Windows (2)
Trang 84Smoothing the Frequency Response
Using Fixed Windows (3)
Window Side lobe
Trang 85Smoothing the Frequency Response
Using Fixed Windows (4)
Trang 86Smoothing the Frequency Response
Using Fixed Windows (5)
1 Given the design specification {ω p , ω s , A p , A s }, determine the
ripples δ p , δ s , and set δ = min{δ p , δ s }.
2 Determine the cutoff frequency of the ideal lowpass prototype by
ω
c = (ω p + ω s )/2.
3 Determine the design parameters A = –20log 10 δ & Δω = ω s – ω p
4 From the table choose the window function that provides the
smallest stopband attenuation greater than A.
5 Determine M = L – 1 from Δω in the table If M is odd, we may
increase it by one.
6 Determine the impulse response of the ideal lowpass filter by
7 Compute the impulse response h[n] = h d [n]w[n].
8 Check whether the designed filter satisfies the prescribed
specifications; if not, increase the order M and go back to step 6.
c d
n M
h n
n M
ω π
−
=
−
Trang 87Smoothing the Frequency Response
Using Fixed Windows (6)
Design a lowpass linear-phase FIR to satisfy the following specifications:
Δω (exact)
δ p ≈ δ s A p
(dB)
A s (dB)
Rect –13 4π/L 1.8π/L 0.09 0.75 21Bartlett –25 8π/L 6.1π/L 0.05 0.45 26Hann –31 8π/L 6.2π/L 0.0063 0.055 44Hamming –41 8π/L 6.6π/L 0.0022 0.019 53Blackman –57 12π/L 11π/L 0.0002 0.0017 74
Trang 88Smoothing the Frequency Response
Using Fixed Windows (7)
Design a lowpass linear-phase FIR to satisfy the following specifications:
-3 Approximation error
Trang 89Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
i Direct Truncation of an Ideal Impulse Response
ii Smoothing the Frequency Response Using Fixed
Windows
iii Filter Design Using the Adjustable Kaiser Window
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design g) Design of Some Special FIR Filters
Trang 90Filter Design Using the
Adjustable Kaiser Window (1)
2 0
A M
ω
−
=
∆
Trang 91Filter Design Using the Adjustable Kaiser Window (2)
20
0.2 0.4 0.6 0.8 1
Kaiser, M = 20
= 0 = 5 = 8
-100 -80 -60 -40 -20
Trang 92Filter Design Using the Adjustable Kaiser Window (3)
1 Given the design specification {ω p , ω s , A p , A s }, determine the
ripples δ p , δ s , and set δ = max{δ p , δ s }.
2 Determine the cutoff frequency of the ideal lowpass prototype by
ω
c = (ω p + ω s )/2.
3 Determine the design parameters A = –20log 10 δ & Δω = ω s – ω p
4 Determine the required values of & M from formulae If M is odd,
we may increase it by one.
5 Determine the impulse response of the ideal lowpass filter by
6 Compute the impulse response h[n] = h d [n]w[n].
7 Check whether the designed filter satisfies the prescribed
specifications; if not, increase the order M and go back to step 6.
c d
n M
h n
n M
ω π
−
=
−
Trang 93Filter Design Using the Adjustable Kaiser Window (4)
Design a lowpass linear-phase FIR to satisfy the following specifications:
Trang 94Filter Design Using the Adjustable Kaiser Window (5)
Design a lowpass linear-phase FIR to satisfy the following specifications:
10-3 Approximation error
Trang 95Filter Design Using the Adjustable Kaiser Window (6)
Ex 2
Design a bandpass filter using a Kaiser window:
( ) 0.01, 0.2 0.99 ( ) 1.01, 0.3 0.7
Trang 96Filter Design Using the Adjustable Kaiser Window (7)
−
=
−
1 1
40 8
55.7 2.285(0.08 )
Trang 97Filter Design Using the Adjustable Kaiser Window (8)
10-3 Approxim ation error
Trang 98Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax
Trang 99Design of FIR Filter by Frequency Sampling (1)
Trang 100Design of FIR Filter by
L
Q −
=
Trang 101Design of FIR Filter by Frequency Sampling (3)
ω π
Trang 102Design of FIR Filter by Frequency Sampling (4)
/ 0
/ 0
Trang 103Design of FIR Filter by Frequency Sampling (5)
/ 0
Trang 104Design of FIR Filter by Frequency Sampling (6)
1 Choose the order of the filter M by placing at least
two samples in the transition band.
2 For a window design approach obtain samples of the
desired frequency response H d [k] For a smooth
transition band approach, use a straight-line or a
raised-cosine.
3 Compute the (M + 1)-point IDFT of H d [k] to obtain
h [n] For a window design approach multiply h[n] by
the appropriate window function.
4 Compute response H d (e jω ) and verify the design over
passband & stopband.
5 If the specifications are not met, increase M & go back
to step 1.
Trang 105Design of FIR Filter by Frequency Sampling (7)
Design a lowpass linear-phase FIR to satisfy the following specifications:
Trang 106Design of FIR Filter by Frequency Sampling (8)
Ex 1
Trang 107Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax
Trang 108Chebyshev Polynomials &
Trang 109Chebyshev Polynomials &
Trang 110Chebyshev Polynomials &
Trang 111Chebyshev Polynomials &
Minimax Approximation (4)
• Chebyshev’s theorem : Off all polynomials of
degree m with coefficient of x m equal to 1, the
Chebyshev polynomial T m (x) multiplied by
2 –(m – 1) has the least maximum amplitude on the interval [–1, 1].
• Alternation theorem : Suppose that f(x) is a
continuous function Then P m (x) is the best
minimax approximating polynomial to f(x) if and only if the error e(x) = f(x) – P m (x) has an (m+2)-point equiripple property.
Trang 112Chebyshev Polynomials &
( ) ( ) ( ) 0.125
e x = x − P x = x − + x
Trang 113Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling e) Chebyshev Polynomials & Minimax
Trang 114Equiripple Optimum Chebyshev
FIR Filter Design (1)
sin , sin( / 2),
odd even
Trang 115Equiripple Optimum Chebyshev
FIR Filter Design (2)
Trang 116Equiripple Optimum Chebyshev
FIR Filter Design (3)
R j
then a necessary and sufficient condition that P(ejω) be the unique solution of
is that the weighted error function E(ω) exhibit at least R + 2 alternation in B.
That is, there must exist R + 2 extremal frequencies ω1 < ω2 < …< ωR+2
such that for every k = 1, 2, …, R + 2:
Trang 117Equiripple Optimum Chebyshev
FIR Filter Design (4)
Trang 118Equiripple Optimum Chebyshev
FIR Filter Design (5)
Calculate error E(ω)
& find local maxima
Trang 119Equiripple Optimum Chebyshev
FIR Filter Design (6)
Design a lowpass linear-phase FIR to satisfy the following specifications:
Trang 120Equiripple Optimum Chebyshev
FIR Filter Design (7)
Design a lowpass linear-phase FIR to satisfy the following specifications:
ωp = 0.25π; ωs = 0.35π; Ap = 0.1dB; As = 50dB.
Ex 1
Trang 121Equiripple Optimum Chebyshev
FIR Filter Design (8)
Trang 122Equiripple Optimum Chebyshev
FIR Filter Design (9)
Ex 2
Design a bandpass filter using a Kaiser window:
( ) 0.01, 0.2 0.99 ( ) 1.01, 0.3 0.7
( ) 0.01, 0.78
j j j
H e
H e
H e
ωωω
Trang 123Equiripple Optimum Chebyshev
FIR Filter Design (10)
Ex 2
Trang 124Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design
g) Design of Some Special FIR Filters
i Discrete-Time Differentiators
ii Discrete-Time Hilbert Transformers
iii Ideal Raised-Cosine Pulse-Shaping Lowpass Filter
Trang 126Discrete-Time Differentiators (2)
Trang 127Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design
g) Design of Some Special FIR Filters
i Discrete-Time Differentiators
ii Discrete-Time Hilbert Transformers
iii Ideal Raised-Cosine Pulse-Shaping Lowpass Filter
Trang 128Hamming window method
/
0 0.2 0.4 0.6 0.8 1
Frequency sampling method
Trang 129Design of FIR Filters
a) The Filter Design Problem
b) FIR Filters with Linear Phase
c) Design of FIR Filter by Windowing
d) Design of FIR Filter by Frequency Sampling
e) Chebyshev Polynomials & Minimax Approximation f) Equiripple Optimum Chebyshev FIR Filter Design
g) Design of Some Special FIR Filters
i Discrete-Time Differentiators
ii Discrete-Time Hilbert Transformers
iii Ideal Raised-Cosine Pulse-Shaping Lowpass Filter
Trang 130Ideal Raised-Cosine Pulse-Shaping Lowpass Filters
n
0 0.1 0.2 0.3
Trang 131Discrete Filters
1 Types of Filters
2 Transfer Function and Frequency Response
3 Group Delay and Inverse System
4 Minimum and Linear Phase Filters
5 Design of FIR Filters
6 Design of IIR Filters
7 Structure of Realization of Discrete Filters