Chapter 3 Slides
Chapter 3 Slides
Applications
1
Chapter 3(a): Finite Impulse Response (FIR)
Filter Design
2
Finite Impulse Response (FIR) Filter
3
Finite Impulse Response (FIR) Filter
Y ( z ) = b0 X ( z ) + b1 z −1 X ( z ) + ... + bK z − K X ( z )
4
Stability
5
Example 1
6
Solution
7
Design Objective
8
Fourier Transform Design
Table 7.1: Summary of Ideal Impulse
Responses for Standard FIR Filters
Filter Type Ideal Impulse Response h(n)
Ωc
π , n=0
Lowpass: h( n ) =
sin(Ω c n) , n ≠ 0
nπ
π − Ωc
, n=0
Highpass: h ( n) =
π
− sin(Ω c n) , n ≠ 0
nπ
Frequency response of an ΩH − ΩL
, n=0
ideal lowpass filter Bandpass: h(n) =
π
sin(Ω H n) − sin(Ω L n) , n ≠ 0
nπ
π − (Ω H − Ω L )
, n=0
Bandstop: h(n) =
π
− sin(Ω H n) + sin(Ω L n) , n ≠ 0
9 nπ
Example 2
10
Solution
11
The ideal impulse response for standard FIR lowpass
filter is given by Ωc
, n=0
π
h( n) =
sin(Ω c n) , n ≠ 0
nπ
0.2π
h(n = 0) = = 0.2
π
sin(0.2nπ )
For n ≠ 0, h(n) =
nπ
sin(0.2π )
h(1) = = 0.1871
π
Theoretically h(n) exists for -∞ < n < ∞ and is
symmetrical about n = 0, i.e. h(n) = h(-n).
Using the symmetry leads to h(-1) = h(1) = 0.1871.
The impulse response is truncated.
12
To remedy the non-causality, we delay the truncated
impulse response h(n) by M samples to yield the
following causal FIR filter:
H ( z ) = b0 + b1 z −1 + ... + b2 M z −2 M
Q 2M + 1 = 3 ∴ M = 1
b0 = h(0 − 1) = h(−1) = 0.1871
b1 = h(0) = 0.2
b2 = h(1) = 0.1871
13
(b) The transfer function is
H ( z ) = b0 + b1 z −1 + b2 z −2 = 0.1871 + 0.2 z −1 + 0.1871z −2
Y ( z)
= 0.1871 + 0.2 z −1 + 0.1871z −2
X ( z)
Y ( z ) = 0.1871X ( z ) + 0.2 z −1 X ( z ) + 0.1871z −2 X ( z )
14
(c) Substituting z = e jΩ into H ( z )
it follows that H (e jΩ ) = 0.1871 + 0.2e − jΩ + 0.1871e − j 2 Ω
= e − jΩ (0.1871e jΩ + 0.2 + 0.1871e − jΩ )
= e − jΩ (0.2 + 0.3742 cos Ω)
The magnitude frequency response is found to be
H (e jΩ ) = 0.2 + 0.3742 cos Ω
15
Example 3
16
Solution
Sampling rate, fs = 8000 Hz
Sampling time, Ts = 1/8000 s
Lower cutoff frequency, fL = 2000 Hz
Normalized lower cutoff frequency,
fL 2000
Ω L = 2π f LTs = 2π = 2π × = 0.5π radians
fs 8000
Upper cutoff frequency, fH = 2400 Hz
Normalized upper cutoff frequency,
fH 2400
Ω H = 2π f H Ts = 2π = 2π × = 0.6π radians
fs 8000
17
The ideal impulse response for standard FIR bandpass
filter is given by
ΩH − ΩL
, n=0
h( n) =
π
sin(Ω H n) − sin(Ω L n) , n ≠ 0
nπ
Ω − Ω L 0.6π − 0.5π
h(0) = H = = 0.1
π π
sin(0.6π ) − sin(0.5π ) 0.95106 − 1
h(1) = = = −0.01558
π π
sin(1.2π ) − sin(π ) −0.58779 − 0
h(2) = = = −0.09355
2π 2π
Theoretically h(n) exists for -∞ < n < ∞ and is
symmetrical about n = 0, i.e. h(n) = h(-n).
Using the symmetry leads to h(-1) = h(1) = -0.01558,
h(-2) = h(2) = -0.09355. 18
The delay operation is given by bn = h(n − M ) for n = 0,1,..., 2 M
Q 2M + 1 = 5
∴M = 2
Delaying h(n) by M = 2 samples gives
b0 = h(0 − 2) = h( −2) = −0.09355
b1 = h(1 − 2) = h( −1) = −0.01558
b2 = h(2 − 2) = h(0) = 0.1
b3 = h(3 − 2) = h(1) = −0.01558
b4 = h(4 − 2) = h(2) = −0.09355
19
(b) The transfer function is
Y ( z)
H ( z) = = b0 + b1z −1 + b2 z −2 + b3 z −3 + b4 z −4
X ( z)
Y ( z)
= −0.09355 − 0.01558 z −1 + 0.1z −2 − 0.01558 z −3 − 0.09355 z −4
X ( z)
Y ( z ) = −0.09355 X ( z ) − 0.01558 z −1 X ( z ) + 0.1z −2 X ( z )
− 0.01558 z −3 X ( z ) − 0.09355 z −4 X ( z )
20
jΩ
Substituting z = e into H ( z )
it follows that
H (e jΩ ) = −0.09355 − 0.01558e − jΩ + 0.1e− j 2 Ω − 0.01558e − j 3Ω − 0.09355e − j 4 Ω
= e − j 2 Ω (−0.09355e j 2 Ω − 0.01558e jΩ + 0.1 − 0.01558e − jΩ − 0.09355e− j 2 Ω )
= e − j 2 Ω ( 0.1 − 0.03116 cos Ω − 0.1871cos(2Ω) )
21
Gibbs Effect
22
Gibbs Effect
28
Solution nπ
M = 3, wham ( n) = 0.54 + 0.46 cos
3
−3π
wham ( −3) = 0.54 + 0.46 cos = 0.08
3
−2π
wham ( −2) = 0.54 + 0.46 cos = 0.31
3
−π
wham ( −1) = 0.54 + 0.46 cos = 0.77
3
wham (0) = 0.54 + 0.46 cos ( 0 ) = 1
π
wham (1) = 0.54 + 0.46 cos = 0.77
3
2π
wham (2) = 0.54 + 0.46 cos = 0.31
3
3π
wham (3) = 0.54 + 0.46 cos = 0.08
29 3
Applying the Hamming window function and its
symmetric property to the filter coefficients, we get
hw (0) = h(0) ⋅ wham (0) = 0.25 × 1 = 0.25
hw ( −1) = hw (1) = h(1) ⋅ wham (1) = 0.22508 × 0.77 = 0.17331
hw ( −2) = hw (2) = h(2) ⋅ wham (2) = 0.15915 × 0.31 = 0.04934
hw ( −3) = hw (3) = h(3) ⋅ wham (3) = 0.07503 × 0.08 = 0.00600
30
Example 5
31
Solution Ωc
n=0
π ,
h( n) =
sin(Ω c n) , n ≠ 0
nπ
0.2π
h(n = 0) = = 0.2
Cutoff frequency, fc = 800 Hz π
sin(0.2nπ )
Sampling rate, fs = 8000 Hz For n ≠ 0, h(n) =
nπ
Sampling time, Ts = 1/8000 s h(1) =
sin(0.2π )
= 0.1871
π
Normalized cutoff frequency,
fc 800
Ω c = 2π f cTs = 2π = 2π × = 0.2π radians
fs 8000
32
Q 2M + 1 = 3
∴M =1
Applying the Hamming window function,
nπ
wham (n) = 0.54 + 0.46 cos
1
wham (0) = 0.54 + 0.46 cos ( 0 ) = 1
wham (1) = 0.54 + 0.46 cos (π ) = 0.08
Using the symmetry of the window function gives
wham ( −1) = wham (1) = 0.08
34
jΩ
(c) Substituting z = e into H ( z )
it follows that H (e jΩ ) = 0.01497 + 0.2e − jΩ + 0.01497e − j 2 Ω
= e − jΩ (0.01497e jΩ + 0.2 + 0.01497e − jΩ )
= e − jΩ (0.2 + 0.02994 cos Ω)
35
| f stop − f pass |
Normalized transition band, ∆f =
fs
f pass + f stop
Cutoff frequency, f c =
2
Passband ripple, δ p dB = 20 log10 (1 + δ p )
Stopband attenuation, δ s dB = −20 log10 (δ s )
36
Example 6
37
Solution
A rectangular window results in a passband ripple of
0.74 dB and stopband attenuation of 21 dB. Selecting a
rectangular window will satisfy the design requirement.
The normalized transition band is given by
| f stop − f pass | 2150 − 1850
∆f = = = 0.0375
fs 8000
0.9 0.9
N= = = 24
∆f 0.0375
We choose the smallest odd number that is larger than
24, i.e. N = 25.
1850 + 2150
fc = = 2000 Hz
2
38
Chapter 3(b): Infinite Impulse Response
(IIR) Filter Design
39
Infinite Impulse Response (IIR) Filter
An IIR filter is described using the following difference
equation:
y (n) = b0 x(n) + b1 x(n − 1) + ... + bM x(n − M )
−a1 y (n − 1) − ... − aN y (n − N )
M N
y (n) = bi x(n − i ) − a j y (n − j )
i =0 j =1
41
Solution
42
Bilinear Transformation (BLT) Design
Method
43
Bilinear Transformation (BLT) Design Method
44
Transformation by Lowpass Prototype
Filter
45
Analog Filters Using Lowpass Prototype
Transformation
Analog
lowpass
prototype
to lowpass
filter
Analog
lowpass
prototype
to highpass
filter
46
Analog
lowpass
prototype
to
bandpass
filter
Analog
lowpass
prototype
to
bandstop
filter
47
Table 8.1: Analog Lowpass Prototype Transformations
48
Example 8
49
Solution
1 s
H HP ( s ) = =
40
+ 1 s + 40
s
50
Solution
51
Bilinear Transformation (BLT) and
Frequency Warping
The BLT method is a mapping or transformation of
points on the s-plane to the z-plane, which is given in
either one of the following equations:
2 z −1
s= ⋅
T z +1
1 + sT / 2
z=
1 − sT / 2
52
Mapping between the s-plane and the
z-plane by the bilinear transformation
53
Example 9
10
H ( s) =
s + 10
convert it to the digital filter transfer function and obtain
the difference equation when the sampling period is
T = 0.01 s.
54
Solution
2 z −1 10
Substitute with s = ⋅ , we have H ( z ) = 2 z − 1
T z +1 ⋅ + 10
T z +1
1
H ( z) =
z −1
20 +1
z +1
z +1
=
21z − 19
1
+ 1
= 21 1921z
1 − 21z
0.0476 + 0.0476 z −1
=
1 − 0.9048 z −1
55
The difference equation is found as follows:
Y ( z ) 0.0476 + 0.0476 z −1
=
X ( z) 1 − 0.9048 z −1
(1 − 0.9048 z −1 )Y ( z ) = (0.0476 + 0.0476 z −1 ) X ( z )
y (n) − 0.9048 y (n − 1) = 0.0476 x(n) + 0.0476 x( n − 1)
y (n) = 0.0476 x(n) + 0.0476 x(n − 1) + 0.9048 y (n − 1)
56
Let ωa denote the analog frequency marked on the jω-axis on
the s-plane, and ωd denote the digital frequency marked on
the unit circle in the z-plane.
jωd T
2 e −1
jωa = . jω T
T e d +1
2 ωd T
ωa = tan
T 2
2 −1 ωaT
ωd = tan
T 2
57
Frequency Warping from Bilinear
Transformation
58
Bilinear Transformation (BLT) Design
Procedure
1. Given the digital filter frequency specifications,
prewarp the digital frequency specifications to the
analog frequency specifications.
2 ωd T
ωa = tan
T 2
2. Perform the prototype transformation using the
lowpass prototype HP(s) (as tabulated in Table 8.1).
3. Substitute the BLT to obtain the digital filter.
H ( z ) = H ( s) | 2 z −1
s= ⋅
T z +1
59
60
Example 10
61
Solution
ωd = 2πf = 2π(15) = 30π rad/s, and T = 1/fs = (1/90) s
1. 2 ωd T
ωa = tan
T 2
30π
= 180 tan
180
= 60 3
= 103.92 rad/s
2. 1 ωa
H ( s) = H P ( s) | s = s =
s=
ωa ωa + 1 s + ωa
60 3
H (s) =
s + 60 3
62
3.
H ( z ) = H ( s ) s = 2 . z −1
T z +1
z +1
60 3 =
= (1 + 3 ) z + 1 − 3
2 z −1
. + 60 3 1 1
T z +1 + z −1
3 = 1+ 3 1+ 3
= 1 − 3 −1
z −1 1+ z
3. + 3 1+ 3
z +1
z +1 0.3660 + 0.3660 z −1
= =
3 ( z − 1) + z + 1 1 − 0.2679 z −1
63
Digital Butterworth and Chebyshev
Filter Designs
64
Butterworth Filter
First described by the British engineer, Stephen
Butterworth in 1930.
Designed to have a frequency response which is as flat
as mathematically possible in the passband.
Also known as maximally flat magnitude filters.
Maximally flat – no ripples in passband and rolls off
towards zero in stopband.
Has a monotonically changing magnitude function with
ω.
Is the only filter that maintains this same shape for
higher orders (but with a steeper decline in the
stopband).
65
Butterworth filter is characterised by the magnitude
function
2 1
H (ω ) = where n = filter order
1 + ω 2n
The magnitude is a monotonic decreasing function of ω,
with its maximum value of unity occurring at ω = 0.
1
For ω = 1, the magnitude is equal to H (ω ) = for
all n. 2
66
Plot of the gain of Butterworth lowpass filters of orders
1 to 5. Note that the slope is -20n dB/decade where n is
the filter order. 67
The magnitude of transfer function for Butterworth approximation is
1
H ( jω ) =
1 + ε 2ω 2n
68
With the given passband ripple Ap dB at the normalized
passband frequency edge vp = 1,
(
Ap = 10 log 1 + ε 2 ) vp =
ωp
2 0.1 Ap ωp
ε = 10 −1
(
As = 10 log 1 + ε 2vs2n ) vs =
ωs
ε 2vs2n = 100.1As − 1 ωp
69
100.1 As − 1 100.1 As − 1
vsn = 0. 1 A p
=
10 −1 ε2
0.1 As
10 −1
20 log10
n= ε2
20 log10 (vs )
100.1 As − 1
log10
ε 2
n≥
2 log10 (vs )
70
Table 8.3: 3-dB Butterworth Lowpass
Prototype Transfer Functions (ε = 1)
n H P (s)
1
1
s +1
1
2
s 2 + 1.4142s + 1
1
3
s3 + 2s 2 + 2s + 1
71
Chebyshev Filter
Is named in honor of Pafnuty Chebyshev because their
mathematical characteristics are derived from
Chebyshev polynomials.
72
Chebyshev type 2
Not covered in this course
73
1
Chebyshev approximation H ( jω ) =
1 + ε 2Cn2 (ω )
(
Cn (ω ) = cos n cos −1 ω ; ) | ω |≤ 1
and (
Cn (ω ) = cosh n cosh −1 ω ; ) | ω |> 1
n = 0, C0(ω) = 1
n = 1, C1(ω) = ω
1 x
cosh x = (e + e − x )
2
cosh −1 x = ln( x + x 2 − 1); x ≥ 1
74
With the given passband ripple Ap dB at the normalized
passband frequency edge vp = 1,
( ) (
Ap = 10 log 1 + ε 2Cn2 (1) = 10 log 1 + ε 2 )
2 0.1 Ap
ε = 10 −1
(
As = 10 log 1 + ε 2Cn2 (vs ) )
ε 2Cn2 (vs ) = 100.1As − 1
75
100.1 As − 1 100.1 As − 1
C n (v s ) = 0.1 Ap
=
10 −1 ε2
100.1 As − 1
cosh( n cosh −1 vs ) =
ε2
100.1 As − 1
n cosh −1 vs = cosh −1 2
ε
100.1 As − 1
cosh −1
ε 2
n≥
cosh −1 (vs )
76
Table 8.4: Chebyshev
Lowpass Prototype
Transfer Functions with
0.5 dB Ripple (ε =
0.3493)
n H P ( s)
2.8628
1
s + 2.8628
1.4314
2
s 2 + 1.4256s + 1.5162
0.7157
3 3
s + 1.2529s 2 + 1.5349s + 0.7157
77
Table 8.5: Chebyshev
Lowpass Prototype
Transfer Functions with 1
dB Ripple (ε = 0.5088)
n H P (s)
1.9652
1
s + 1.9652
0.9826
2
s 2 + 1.0977 s + 1.1025
0.4913
3
s 3 + 0.9883s 2 + 1.2384s + 0.4913
78
Table 8.6: Conversion from Analog Filter
Specifications to Lowpass Prototype Specifications
Analog Filter Specifications Lowpass Prototype Specifications
ωas
Lowpass: ωap , ωas vs =
ωap
ωap
Highpass: ωap , ωas vs =
ωas
Bandpass: ωapl , ωaph , ωasl , ωash ωash − ωasl
vs =
ω0 = ωaplωaph , ω0 = ωaslωash ωaph − ωapl
Bandstop: ωapl , ωaph , ωasl , ωash ωaph − ωapl
vs =
ω0 = ωaplωaph , ω0 = ωaslωash ωash − ωasl
80
Example 11
81
Solution
2 ωdpT 2 ωdsT
ωap = tan ωas = tan
T 2 T 2
3000π 6000π
= 16000 tan = 16000 tan
16000
16000
= 1.0691× 10 4 rad/s 82
= 3.8627 × 104 rad/s
From Table 8.6, we find the lowpass prototype
specifications as follows:
ωas 3.8627
vs = = = 3.6130
ωap 1.0691
Ap = 3 dB is given in the question.
The absolute ripple parameter is found as
0.1 Ap
ε 2 = 10 −1
ε =1
83
As = 10 dB is given in the question.
The Butterworth lowpass prototype with order n is
given as
10 0.1 As − 1
log10
ε 2
n≥
2 log10 (vs )
10 0.1(10) − 1
log10
1
n≥ = 0.8553
2 log10 (3.6130)
84
2. Rounding n up, we choose n = 1 for the lowpass
prototype. From Table 8.3, we have
1
H P (s) =
s +1
1 ω ap 1.0691× 10 4
H ( s) = H P ( s) | s = s = = 4
s=
ωap ωap
+ 1 s + ω ap s + 1.0691 × 10
85
3. Finally, using the BLT, we have
H ( z ) = H ( s) | 2 z −1
s= ⋅
T z +1
1.0691×104
=
2 z −1
⋅ + 1.0691× 104
T z +1
1.0691
=
z −1
1.6 + 1.0691
z +1
1.0691z + 1.0691
=
1.6 z − 1.6 + 1.0691z + 1.0691
1.0691z + 1.0691
=
2.6691z − 0.5309
0.4005 + 0.4005 z −1
=
1 − 0.1989 z −1
86
Example 12
87
Solution
From the specifications, we obtain the digital
frequencies in rad/s as follows:
ωdp = 2πf = 2π(3000) = 6000π rad/s
ωds = 2π(1000) = 2000π rad/s
T = 1/fs = (1/8000) s
1. Using the design procedure, it follows that
2 ωdpT 2 ω T
ωap = tan ωas = tan ds
T 2 T 2
6000π 2000π
= 16000 tan = 16000 tan
16000 16000
= 3.8627 × 10 4 rad/s = 6.6274 × 103 rad/s
88
From Table 8.6, we find the lowpass prototype
specification (that corresponds to highpass analog filter
specification) as follows:
ωap 3.8627 ×104
vs = = 3
= 5.8284
ωas 6.6274 ×10
Ap = 0.5 dB is given in the question.
2 0.1 Ap
ε = 10 − 1 = 0.1220
89
As = 25 dB is given in the question.
The Chebyshev lowpass prototype with order n is given
as 100.1 A − 1
s
cosh −1
ε 2
n≥
cosh −1 (vs )
100.1(25) − 1
cosh −1
0.1220
=
cosh −1 (5.8284)
cosh −1 (50.8314)
=
cosh −1 (5.8284)
=
(
ln 50.8314 + 50.83142 − 1 )
(
ln 5.8284 + 5.82842 − 1 )
= 1.8875 90
2. Rounding n up, we choose n = 2 for the lowpass
prototype. From Table 8.4, we have
1.4314
H P (s) =
s 2 + 1.4256 s + 1.5162
H ( s) = H P (s) | ωap
s=
Applying the prototype s
1.4314
transformation (lowpass = 2 ωap
s + 1.4256 s + 1.5162 s=
s
to highpass) yields the 1.4314
= 2
analog filter ωap ωap
+ 1.4256 + 1.5162
s s
1.4314 s 2
=
ωap 2 + 1.4256ωap s + 1.5162s 2
0.9441s 2
= 2
91 s + 3.6319 ×104 s + 9.8407 ×108
H ( z ) = H (s) | 2 z −1
3. Using the s= ⋅
T z +1
the analog z +1
2
z −1
filter to the 0.9441 16000 ×
= z +1
2
digital filter
16000 ×
z −1
+ 3.6319 × 10 4
× 16000 ×
z −1
+ 9.8407 ×108
z +1 z +1
2
z −1
0.9441
= z +1
2
z −1 z −1
+ 2.2699 × + 3.8440
z +1 z +1
0.9441( z − 1) 2
=
( z − 1)2 + 2.2699( z 2 − 1) + 3.8440( z + 1)2
0.9441( z 2 − 2 z + 1)
= 2
z − 2 z + 1 + 2.2699 z 2 − 2.2699 + 3.8440( z 2 + 2 z + 1)
0.9441( z 2 − 2 z + 1)
=
7.1139 z 2 + 5.688 z + 2.5741
0.1327 − 0.2654 z −1 + 0.1327 z −2
=
1 + 0.7996 z −1 + 0.3618 z −2
92
Impulse-Invariant Design Method
93
Impulse-Invariant Design Method
94
Impulse-Invariant Design Method
95
Why is there a need to scale the impulse response by T?
98
Solution
Taking the inverse Laplace transform of the analog
transfer function,
h(t ) = 2e−2t u (t )
99
Application Examples of Digital Filters
100