You are on page 1of 38

Lectures 23-24 EE-802 ADSP SEECS-NUST

EE 802-Advanced Digital Signal


Processing
Dr. Amir A. Khan
Office : A-218, SEECS
9085-2162; amir.ali@seecs.edu.pk
1
Lectures 23-24 EE-802 ADSP SEECS-NUST
Lecture Outline
Filter Design (From Oppenheim)
2
Lectures 23-24 EE-802 ADSP SEECS-NUST
Introduction
The term Filters originate from frequency-selective
filtering
modify certain frequencies relative to others
Analysis vs. Design


Analysis
Pole-zero distribution
System properties (Causality/Stability)
Frequency response
System structural realizations
Study system behavior
Design
Practical realization poses causality and stability constraints
coefficients a
k
have strict constraints
Additionally, a linear phase requirement for H(z) may be desirable
Find system coefficients, i.e. M;N;a
1
; ;a
N
; b
0
; ;b
M
,
s.t.
3
Lectures 23-24 EE-802 ADSP SEECS-NUST
Filter Design Overview
Design of Discrete-Time IIR Filters From
Continuous-Time (Analog) Filters
Impulse Invariance
Bilinear Transformation

Common Discrete-time filters
Butterworth
Chebyshev
Elliptic

Design of FIR Filters
Windowing Method
Frequency Sampling Method
Optimum Filter Design (Park-McClellan)
4
Lectures 23-24 EE-802 ADSP SEECS-NUST
Typical low-pass specifications
Parameters
[0;e
p
] = pass-band
[e
s
;

t] = stop-band
[e
p
; e
s
] = transition-band
o
p1
; o
p2
= pass-band ripple; Often expressed in dB via 20log
10
(1+o
p
)
o
s
= stop-band ripple; Often expressed in dB via 20log
10
(o
s
)
5
Lectures 23-24 EE-802 ADSP SEECS-NUST
FIR or IIR ?
The choice between IIR and FIR usually based on phase considerations
GLP (generalized linear phase) constraint
FIR with GLP
IIR with GLP
IIR filters cannot be stable, causal and GLP at same time
If GLP desired : choose FIR
If GLP not desired : IIR can be chosen
6
Lectures 23-24 EE-802 ADSP SEECS-NUST
IIR Filter Design
Based on established methods for analog filter design
Approach usually restricted to low pass and band pass filters
Basic filter type is low pass
High pass or band pass filters generally created using
frequency transformations
Design Steps
Choose prototype analog filter
Butterworth, Chebyshev, Elliptic
Choose analog to digital transformation method
Impulse Invariance, Bilinear Transformation
Transform digital filter specs to equivalent analog filter specs
Design analog filter
Transform analog filter to digital filter
Perform Frequency transformation if necessary
7
Lectures 23-24 EE-802 ADSP SEECS-NUST
IIR Filter Design Steps
1. Start with filter specifications in digital frequency
2. Choose a design methodology (impulse invariance, bilinear
transformation)
3. Convert digital frequency specs. into analog frequency specs (i.e.
e to O ) depending on design method chosen
4. Select a prototype analog filter (Butterworth, Chebyshev, Elliptic)
5. Design the analog filter according to the analog frequency specs
involves selecting the filter cut-off frequencies and order
6. Obtain the corresponding filter transfer function (H(s) Laplace Tr.)
7. Convert this analog filter (H(s)) to the digital filter (H(z))
according to the design methodology initially chosen

8
Lectures 23-24 EE-802 ADSP SEECS-NUST
Impulse Invariance Roundup !
Based on choosing a discrete time impulse response h[n] that is similar to
continuous-time impulse response h(t) (Step 7)
Motivated by desire to maintain the shape of frequency response
Frequency axis mapping is linear

Major problem is aliasing
T O = e
O j
o
0
Im(z)
Re(z)
unit-circle
T
t
T
t

9
Lectures 23-24 EE-802 ADSP SEECS-NUST
Impulse Invariance Roundup !
Based on choosing a discrete time impulse response h[n] that is similar to
continuous-time impulse response h(t)
Motivated by desire to maintain the shape of frequency response
Frequency axis mapping is linear

Major problem is aliasing
O j
o
0
Im(z)
Re(z)
unit-circle
T
t
T
t

T O = e
10
Lectures 23-24 EE-802 ADSP SEECS-NUST
Impulse Invariance Roundup !
Based on choosing a discrete time impulse response h[n] that is similar to
continuous-time impulse response h(t)
Motivated by desire to maintain the shape of frequency response
Frequency axis mapping is linear

Major problem is aliasing
T O = e
O j
o
0
Im(z)
Re(z)
unit-circle
T
t
T
t

Many-one mapping = source of aliasing


11
Lectures 23-24 EE-802 ADSP SEECS-NUST
Bilinear Transformation (B.T.)
Algebraic transformation b/w variables s and z
One-one mapping between the s and z-planes




Given a C.T. prototype filter H
c
(s), the corresponding D.T. filter H(z) is



The parameter T
d
has no influence whatsoever in the filter design, it is
cancelled out as we start with digital specs. and return to digital filter while
passing by analog filter


1
1
2 1
( )
1
d
z
s
T z

=
+
1
1
2 1
( ) ( ( ))
1
c
d
z
H z H
T z

=
+
12
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Bilinear Transformation




1 ( / 2)
1 ( / 2)
d
d
T s
z
T s
+
=

Substitute s j o = + O
1 2 2
1 2 2
d d
d d
T j T
z
T j T
o
o
+ + O
=
O
/ /
/ /
O
(1) If o0, then |z|1 for any
similarly, if o0, then |z|1 for all O
(2) If o0, then
1 2

1 2
d
d
j T
z
j T
+ O
=
O
/
/
1 z =
1 2

1 2
j
d
d
j T
e
j T
e
+ O
=
O
/
/
2 1
1
j
j
d
e
s
T e
e
e

| |
=
|
+
\ .
( )
( )
( )
/2
/2
2 sin / 2
2 2
tan / 2
2 cos / 2
j
j
d d
e j
j
s j
T e T
e
e
e
o e
e

(
= + O = =
(

2
tan( )
2
d
T
e
O = 2arctan( / 2)
d
T e = O
Since o0
13
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Bilinear Transformation
2
tan( )
2
d
T
e
O =
2arctan( / 2)
d
T e = O
Whole of left-half s-plane mapped to inside the unit circle in z-plane
The whole of imaginary axis on s-plane mapped to unit circle, no aliasing problem

14
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Bilinear Transformation
2
tan( )
2
d
T
e
O =
2arctan( / 2)
d
T e = O
Bilinear transformation avoids problem of aliasing through complete mapping but
everything comes at a cost ? Whats the cost here?
Non-linear frequency mapping as opposed to impulse invariance where we had a
linear mapping
Non-linear compression of frequency axis has to be compensated in B.T.
This non-linear phenomenon is called Frequency Warping
15
Lectures 23-24 EE-802 ADSP SEECS-NUST
Frequency Warping Effect of Bilinear
Transformation
Note that the
critical frequencies
are pre-warped
16
Lectures 23-24 EE-802 ADSP SEECS-NUST
Phase Warping and Non-linearity of Phase
by B.T.
Dashed line is linear phase and
solid line is phase resulting from bilinear transformation
Effect more pronounced at higher frequencies
17
Lectures 23-24 EE-802 ADSP SEECS-NUST

18
Lectures 23-24 EE-802 ADSP SEECS-NUST
FIR Filter Design
Windowing Method
Truncate (window) the ideal response to
make it FIR
19
Lectures 23-24 EE-802 ADSP SEECS-NUST
FIR Filter Design-Rectangular
Windowing Problems
Magnitude spectra of Rectangular windows of increasing lengths (samples)
Reduction in width of main lobe as M increases
Area under sidelobes remain the same (note Normalized Amplitude plotted here)
20
Lectures 23-24 EE-802 ADSP SEECS-NUST
FIR Filter Design-Rectangular
Windowing Problems
Gibbs phenomenon occurs whenever there is truncation
Increasing M does not yield significant result as oscillations
increase without reducing in amplitude
Transition region becomes smaller with increasing M
Ripples continue to exist especially at discontinuities
Problem is due to sharp discontinuity (in time domain) of rectangular
windows
Solution : Use windows with tapered ends in time domain instead of
sharp discontinuities
21
Lectures 23-24 EE-802 ADSP SEECS-NUST
Getting Around Sharp Discontinuity of
Rectangular Windows
No abrupt discontinuity in time-domain response of windows translates to
low amplitude side lobes in frequency domain
Advantage is the reduced number of ripples
On the hindsight, tapered window results in a wider transition band
(frequency domain)
Wider transition band can always be compensated by using larger length
windows (higher order filter, remember filter order = Window length - 1)

22
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Commonly Used Windows
Rectangular
| |
1, 0
0, otherwise
n M
n e
s s

Bartlett (triangular)
| |
2 / , 0 / 2, even
2 2 / , / 2
0, otherwise
n M n M M
n n M M n M e
s s

= < <

| |
( )
0.5 0.5cos 2 / 0
0, otherwise
n M n M
n
t
e
s s
=

| |
( ) 0.54 0.46cos 2 / 0
0, otherwise
n M n M
n
t
e
s s
=

| |
( ) ( )
0.42 0.5cos 2 / 0.08cos 4 / 0
0, otherwise
n M n M n M
n
t t
e
+ s s
=

Hanning
Hamming
Blackman

23
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Commonly Used Windows
24
Lectures 23-24 EE-802 ADSP SEECS-NUST
Rectangular
Bartlett (triangular)
Hanning
Hamming
Blackman
25
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Commonly Used Windows
Highest amplitude
high oscillations at discontinuity
Smallest width
the sharpest transition
Wider transition region (wider main-lobe) compensated by much lower side-
lobes and thus less ripples
26
Lectures 23-24 EE-802 ADSP SEECS-NUST
Example : Window Comparison
Rectangular window
Hanning Window
Less ripples in Hanning Window at the cost of larger transition band
Hanning Window
M = 40
Transition band reduced by increasing window length
27
Lectures 23-24 EE-802 ADSP SEECS-NUST
Specifications of Window Design Method
Filter response H(e
je
) should not the shaded regions
28
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Window Design Method (1)
Equal transition bandwidth on both sides of desired (ideal) cut-off
frequency
29
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Window Design Method (2)
Equal peak approximation error o in passband and stopband
30
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Window Design Method (3)
Main lobe of window is wider than the width of transition band
31
Lectures 23-24 EE-802 ADSP SEECS-NUST
Properties of Window Design Method (4)
Peak approximation error o depends on window shape and
independent of window size (filter order) 32
Lectures 23-24 EE-802 ADSP SEECS-NUST
Design Example
33
Lectures 23-24 EE-802 ADSP SEECS-NUST
Step 1-Design Example : Choice of Window
dB 40 ) 01 . 0 log( 20 ; 01 . 0
2
= = o
Hanning, Hamming and Blackman all satisfy the criterion, we can
chose between Hanning and Hamming to have a smaller transition
band as compared to Blackman for same order
Suppose we choose the Hanning Window
34
Lectures 23-24 EE-802 ADSP SEECS-NUST
Step 2-Design Example : Filter Order
dB 40 ) 01 . 0 log( 20 ; 01 . 0
2
= = o
Suppose we choose the Hanning Window
Width of main lobe = e
s
e
p
= 0.3t 0.2t = 0.1t = 8t/M ; M = 80
p
e
s
e
35
Lectures 23-24 EE-802 ADSP SEECS-NUST
Step 3-Design Example : Specify Ideal
Response H
d
(e)
p
e
s
e
Ideal Filter cut-off frequency
Ideal low-pass filter
36
Lectures 23-24 EE-802 ADSP SEECS-NUST
Step 4-Design Example : Specify Ideal
Impulse Response h
d
[n]
Non-causal
Make it causal: Delay by M/2
( ) ( )
( ) 40
40 5 . 0 sin
] [


=
n
n
n h
d
t
t

Ideal Filter Coefficients


37
Lectures 23-24 EE-802 ADSP SEECS-NUST
Step 5-FIR filter coefficients
( ) ( )
( ) 40
40 5 . 0 sin
] [


=
n
n
n h
d
t
t

Ideal Filter Coefficients


| |
( )
0.5 0.5cos 2 / 0
0, otherwise
n M n M
n
t
e
s s
=

Hanning
] [ ]. [ ] [ n w n h n h
d

=
FIR Filter Coefficients
Find frequency response H(e
je
) and verify if it meets specifications

Otherwise, repeat the process by changing either filter order,
window type, or by slightly moving the ideal filter band edge freq.
38

You might also like