Analysis and Design of Digital Filter: EE 422G Notes Instructor: Cheung
Analysis and Design of Digital Filter: EE 422G Notes Instructor: Cheung
H ( e jω )
N
∑ Li z −i
H (z) = i=0
M
1+ ∑ i=
K i z −i
Filter specification in terms
of amplitude response and Transfer function
error tolerance
Advantages:
- Decades of experiences in designing analog filters
- Typical less complex (fewer registers, arithmetic units) than
FIR in realizing the design filter spectrum
Advantages:
- Advantages of any FIR filter : always stable, linear phase
- “Optimal” CAD method (not covered in this class)
General procedure:
1. Design an analog filter Ha(s) that satisfies the specification.
2. Map the analog filter Ha(s) into a discrete-time filter Hd(z)
Page 9-1
EE 422G Notes Instructor: Cheung
ya(t) ya(nT)
y(nT)
x(nT) y(nT)
H(z)
Goal: for a GIVEN x(t), we want the output of our digital filter y(nT) to be
identical to the sampled version ya(nT) of the continuous-time filter output.
0.5( s + 4)
Example: Given H a ( s ) =
( s + 1)( s + 2)
Page 9-2
EE 422G Notes Instructor: Cheung
Step 6: Finally choose a sampling period T and obtain the numerical representation
of the digital filter.
Page 9-3
EE 422G Notes Instructor: Cheung
1.4
1.2
1
Amplitude Response
0.8
0.6
0.4
0.2
0
0 10 20 30 40 50 60 70 80 90 100
Frequency (rad/s)
Frequency (Hz)
Ans: The FT of the discrete filter is periodic with period 2πfs=2π(10)≈ 63 rad/s.
If your client cannot stomach the divergence starting at 30Hz, what should you do?
1.8
1.6
Important: We cannot use
invariance method to design
1.4 any non band-limited filter
Amplitude Response
0.2
0
0 2 4 6 8 10
Frequency (Hz)
Page 9-4
EE 422G Notes Instructor: Cheung
Let’s say you have a low-pass analog filter with cutoff frequency (-3dB frequency)
at 1 rad/s as follows:
1
H ( s) =
( s + 1)( s 2 + s + 1)
To design a HIGH-PASS filter with cutoff frequency at ωp, we use the following
transformation:
ω ω
ω ' = p or equivalently s ' = p
ω s
1 s3
Let ωp=2, H HP ( s ) = =
2 2 2
2
( s + 2)( s 2 + 2 s + 4)
+ 1 + + 1
s s s
0.8
Amplitude Response
0.6
0.4
ω=∞→ω’=0 ω=0→ω’= ∞
0.2
0
0 2 4 6 8 10
Frequency (rad/s)
Page 9-5
EE 422G Notes Instructor: Cheung
CTFT extends from negative infinity to positive infinity, while DTFT is periodic
with period equal to the sampling frequency (2π/T). To ELIMINATE ALIASING,
we need to come up with a frequency transform f such that
0.5ω s = π
1
T
ωc
0.5
-0.5
-1 − 0.5ω s = − π
T
-1.5
-2
-5 0 5
When ωc is small (-1≤ ωc ≤1), the distortion is relatively small and we have
2
ωd ≈ ωc
T
Beyond that, the transformation compresses ωc causing a fair amount of distortion.
If we are designing a low-pass filter with passband -C≤ ωc ≤C, we can scale ωc first
by C and use the transform:
ω d = 2 T arctan (ω c
C )
In most applications, the analog filter is specified in terms of the Laplace variable
s=jωc and the target discrete filter needs to be expressed in Z-transform variable
z=ejωd. Thus, it will be nice if we can derive a transform directly from s to z.
1 − z −1
Bilinear Transformation: s=C
1 + z −1
Page 9-6
EE 422G Notes Instructor: Cheung
Proof:
1 − e − jωd T
jωc = C
1 + e − jωd T
ωd T ωd T
1 − e− j 2
e− j 2
=C ωd T ωd T
1 + e− j 2
e− j 2
ωd T ωd T
ej 2
− e− j 2
=C ωd T ωd T
e j 2 + e− j 2
2 j sin(ωd T 2 )
=C ωd T
= Cj tan (ωd T 2 )
2 cos( 2 )
⇔ ωc = C tan (ωd T 2 )
⇔ ωd = 2 T arctan (ωc C )
Solving C:
ωc
C= = 229168.76
ωc T
tan
2
0.292893 + 0.585786 z −1 + 0.292893z −2
H d ( z) =
1 + 0.171573z −2
Page 9-7
EE 422G Notes Instructor: Cheung
0
4. Delay hnc (nT ) to make it casual.
Page 9-8
EE 422G Notes Instructor: Cheung
1
Example: Design a FIR filter that approximates H ( r ) = (1 + cos 2π r )
2
Solution:
1 1/ 2
Compute hd ( nT ) = ∫ (1 + cos 2πr )e jn 2πr dr
2 −1 / 2
1 1/ 2 1 1/ 2 1 1/ 2 1
For n = 0, dh ( 0 ) = ∫ (1 + cos 2πr ) dr = ∫ dr + ∫ cos 2πrdr =
2 −1 / 2 2 −1 / 2 2 −1 / 2 2
For n ≠ 0 ,
1 1 / 2 jn 2π r 1 1/ 2 e j 2π r + e − j 2π r j 2πnr
hd ( nT ) = ∫ e dr + ∫ e dr
2 −1/ 2 2 −1 / 2 2
1 1/ 2 1 1/ 2 1
= ∫ e j 2π ( n +1) r dr + ∫ e j 2π ( n −1) r dr = for n = ±1 and 0 otherwise
4 −1 / 2 4 −1/ 2 4
∞
1 − j 2π r 1 1 − j 2π r
H ( r ) = ∑
n = −∞
hd ( nT ) e − j 2πn r
=
4
e + + e
2 4
h (0) = 1 , h ( ±T ) =
1
, hd (nT ) = 0, | n |≥ 2
d
2
d
4
The impulse response is finite duration. Thus there is no need to truncate.
M ∞
1 | n |≤ M
where wr ( n ) =
0 | n |> M
Truncation = time multiplication with rectangular window function
Convolving in frequency domain with a sinc function
Page 9-9
EE 422G Notes Instructor: Cheung
M
sin π (2 M + 1) r
wr (e j 2π r ) = ∑e
n=− M
− j 2π n r
=
sin π r
- Sinc function in frequency domain
Suppose the original analog filter H(r) is an ideal low-pass filter, windowing in
time domain corresponds to convolution in frequency with a sinc function.
Sliding sinc function in convolution
Ideal LP
Page 9-10
EE 422G Notes Instructor: Cheung
nπ
0.54 − 0.46 cos 0≤n≤M
Hamming : wh (n ) = M
0 otherwise
Page 9-11
EE 422G Notes Instructor: Cheung
Example: Design a 17-tap low-pass FIR digital filter with Hamming window to
approximate
1 | r |≤ 0.15
H (r ) =
0 0.15 <| r |≤ 0.5
Step 1: Inverse Fourier Transform
0.15 1 1
hd ( nT ) = ∫ e j 2π n r dr =
( e j 0.3π − e − j 0.3π ) = sin 0.3π n
− 0.15 j 2πn πn
d (sin 0.3π n) / d (π n) 0.3 cos 0.3π n
hd (0T ) = lim = lim = 0.3
π n →0 d (π n) / d (π n) π n →0 1
hd (0) = 0.3
sin 0.3πn
h ( nT ) = n≠0
d
πn
Step 2 & 3: Multiply by 17-tap Hamming window (M=8) and make it acausal.
8
H NC ( z ) = ∑h
n = −8
d ( nT ) wh (n) z − n , H C = z −8 H NC ( z )
Page 9-12
EE 422G Notes Instructor: Cheung
Page 9-13