DSP Unit Iv PPT 1
DSP Unit Iv PPT 1
2
Filter Design Techniques
• Any discrete-time system that modifies certain frequencies
• Frequency-selective filters pass only certain frequencies
• Filter Design Steps
– Specification
• Problem or application specific
– Approximation of specification with a discrete-time system
• Our focus is to go from spec to discrete-time system
– Implementation
• Realization of discrete-time systems depends on target technology
• We already studied the use of discrete-time systems to implement a
continuous-time system
– If our specifications are given in continuous time we can use
xn yn
xc(t) C/D H(e )
j
D/C yr(t)
H e j Hc j / T
3
Digital Filter Specifications
• Only the magnitude approximation problem
• Four basic types of ideal filters with magnitude responses
as shown below (Piecewise flat)
H LP (e j ) HHP (e j )
1 1
– c 0 c – c 0 c
HBS (e j )
HBP (e j )
–1 1
– c2 – c1 c1 c2 – c2 – c1 c1 c2
4
Digital Filter Specifications
• These filters are unealisable because (one of the
following is sufficient)
– their impulse responses infinitely long non-
causal
– Their amplitude responses cannot be equal to a
constant over a band of frequencies
Another perspective that provides some
understanding can be obtained by looking at the
ideal amplitude squared.
5
Digital Filter Specifications
• The realisable squared amplitude response transfer
function (and its differential) is continuous in
• Such functions
– if IIR can be infinite at point but around that
point cannot be zero.
– if FIR cannot be infinite anywhere.
• Hence previous differential of ideal response is
unrealisable
6
Digital Filter Specifications
• For example the magnitude response of a digital
lowpass filter may be given as indicated below
7
Digital Filter Specifications
1 p G (e j ) 1 p , p
s
• In the stopband s we require
that G (e j ) 0with a deviation
j
G (e ) s , s
8
Digital Filter Specifications
Filter specification parameters
• p - passband edge frequency
• s - stopband edge frequency
• p - peak ripple value in the passband
• s - peak ripple value in the stopband
9
Digital Filter Specifications
10
Digital Filter Specifications
12
IIR Digital Filter Design
Standard approach
(1) Convert the digital filter specifications into
an analogue prototype lowpass filter
specifications
(2) Determine the analogue lowpass filter
transfer function H a (s )
(3) Transform H a (s ) by replacing the complex
variable to the digital transfer function
G (z )
13
IIR Digital Filter Design
• This approach has been widely used for the
following reasons:
(1) Analogue approximation techniques are
highly advanced
(2) They usually yield closed-form
solutions
(3) Extensive tables are available for
analogue filter design
(4) Very often applications require digital
simulation of analogue systems
14
IIR Digital Filter Design
16
Specification for effective frequency response of a continuous-time lowpass
filter and its corresponding specifications for discrete-time system.
dp or d1 passband ripple
ds or d2 stopband ripple
Wp, wp passband edge frequency
Ws, ws stopband edge frequency
e2 passband ripple parameter
1 – dp = 1/1 + e2
BW bandwidth = wu – wl
wc 3-dB cutoff frequency
wu, wl upper and lower 3-dB cutoff
frequensies
Dw transition band = |wp – ws|
Ap passband ripple in dB
= 20log10(1 dp)
As stopband attenuation in dB
= -20log10(ds) 17
Design of Discrete-Time IIR Filters
18
Reasons of Design of Discrete-Time IIR Filters from
Continuous-Time Filters
19
Characteristics of Commonly Used Analog Filters
• Butterworth Filter
• Chebyshev Filter
– Chebyshev Type I
– Chebyshev Type II of Inverse Chebyshev Filter
20
Butterworth Filter
• Lowpass Butterworth filters are all-pole filters characterized by the magnitude-squared
frequency response
where N is the order of the filter, W c is its – 3-dB frequency (cutoff frequency), W p is the
bandpass edge frequency, and 1/(1 + e 2) is the band-edge value of |H(W)|2.
• Thus the Butterworth filter is completely characterized by the parameters N, d 2, e, and the ratio
Ws/Wp.
21
Butterworth Lowpass Filters
• Passband is designed to be maximally flat
• The magnitude-squared function is of the form
1 1
Hc j
2 2
H s
1 j / j c 1 s / j c
2N c 2N
22
Frequency response of lowpass Butterworth filters
23
Chebyshev Filters
• The magnitude squared response of the analog lowpass Type I Chebyshev
filter of Nth order is given by:
24
Chebyshev Filters
• Equiripple in the passband and monotonic in the stopband
• Or equiripple in the stopband and monotonic in the passband
1
Hc j
2
1 VN / c
2 2
VN x cosN cos1
x
25
Frequency response of
lowpass Type I Chebyshev filter
Frequency response of
lowpass Type II Chebyshev filter
26
N = log10[( 1 - d22 + 1 – d22(1 + e2))/ed2]/log10[(Ws/Wp) + (Ws/Wp)2 – 1 ]
= [cosh-1(d/e)]/[cosh-1(Ws/Wp)]
• The poles of a Type I Chebyshev filter lie on an ellipse in the s-plane with major
axis r1 = Wp{(b2 + 1)/2b] and minor axis r1 = Wp{(b2 - 1)/2b] where b is related to
e according to
b = {[ 1 + e2 + 1]/e}1/N
• The zeros of a Type II Chebyshev filter are located on the imaginary axis.
27
Type I: pole positions are
xk = r2cosfk
yk = r1sinfk
fk = [p/2] + [(2k + 1)p/2N]
r1 = Wp[b2 + 1]/2b
r2 = Wp[b2 – 1]/2b
b = {[ 1 + e2 + 1]/e}1/N
29
Approximation of Derivative Method
• Hence, the system function for the digital IIR filter obtained as a result of the
approximation of the derivatives by finite difference is
H(z) = Ha(s)|s=(z-1)/Tz
• It is clear that points in the LHP of the s-plane are mapped into the
corresponding points inside the unit circle in the z-plane and points in the
RHP of the s-plane are mapped into points outside this circle.
– Consequently, a stable analog filter is transformed into a stable digital filter due
to this mapping property.
jW
Unit circle
s-plane
z-plane
30
Example: Approximation of derivative method
T2
10.2 T 9.01T 2
H ( z) 1
1 2 (10.1T )
10.2 T 9.01T 2 z 1
10.2 T 9.01T 2
z 2
T can be selected to satisfied specification of designed filter. For example, if T = 0.1,
the poles are located at
p1,2 = 0.91 j0.27 = 0.949exp[ j16.5o]
31
Filter Design by Impulse Invariance
• Remember impulse invariance
– Mapping a continuous-time impulse response to discrete-time
– Mapping a continuous-time frequency response to discrete-time
Hc j 0 / Td
•
H
e j
H
c j T cancels
If we start from discrete-time specifications
out
Td
d
– Start with discrete-time spec in terms of
– Go to continuous-time = /T and design continuous-time filter
– Use impulse invariance to map it back to discrete-time = T
• Works best for bandlimited filters due to possible aliasing
32
Impulse Invariance of System Functions
• Develop impulse invariance relation between system functions
• Partial fraction expansion of transfer function
N
Ak
Hc s
k 1 s sk
• Corresponding impulse response
N
Ak esk t t 0
hc t k 1
0 t0
• Impulse response of discrete-time filter
N N
hn Tdhc nTd TdAk e un TdAk esk Td un
sknTd n
• System function k 1 k 1
N
TdAk
Hz sk Td 1
k 1 1 e z
• Pole s=sk in s-domain transform into pole at
esk Td
33
Impulse Invariant Algorithm
34
Example: Impulse invariant method
The analog filter has a zero at s = - 0.1 and a pair of complex conjugate poles at p k = - 0.1 j3.
Thus, 1 1
H a s 2
2
s 0.1 j 3 s 0 .1 j 3
1 1
H z
Then 2
0.1T 1
2
0.1T j 3T
1 e e j 3T
z 1 e e z 1
35
Frequency response
of digital filter.
Frequency response
of analog filter.
36
Disadvantage of previous
techniques: frequency
warping aliasing effect
and error in specifications
of designed filter (frequencies)
So, prewarping of frequency
is considered.
37
Example
• Impulse invariance applied to Butterworth
0. 89125 H e j 1 0 0. 2
He 0.17783
j
0. 3
• Since sampling rate Td cancels out we can assume T d=1
• Map spec to continuous time
0. 89125 Hj 1 0 0. 2
Hj 0.17783 0. 3
1 j / j c
2N
38
Example Cont’d
• Satisfy both2Nconstrains 2 2N 2
0. 2 1 0. 3 1
1 and 1
c 0. 89125 c 0. 17783
0. 12093
Hs• The transfer function
s2 0. 364s 0. 4945 s2 0. 9945s 0. 4945 s2 1. 3585s 0. 4945
• Mapping to0.z-domain
2871 0. 4466z 1 2. 1428 1. 1455z 1
Hz
1 1. 2971z 1 0. 6949z 2 1 1. 0691z 1 0. 3699z 2
1. 8557 0. 6303z 1
1 0. 9972z 1 0. 257z 2
39
Example Cont’d
40
Filter Design by Bilinear Transformation
• Get around the aliasing problem of impulse invariance
• Map the entire s-plane onto the unit-circle in the z-plane
– Nonlinear transformation
– Frequency response subject to warping
• Bilinear transformation
2 1 z 1
s 1
• Transformed system function Td 1 z
2 1 z 1
Hz Hc
1
• Again Td cancels out so we can ignore it Td 1 z
• We can solve the transformation for z as
41
Bilinear Transformation
• On the unit circle the transform becomes
1 j Td / 2
z ej
1 j Td / 2
• Which yields
2 Td
tan or 2 arctan
Td 2 2
42
Bilinear Transformation
43
Example
• Bilinear transform applied to Butterworth
j
0. 89125 H e 1 0 0. 2
He 0.17783
j
0. 3
1 / c
2N
• Toget
2 tan 0. 1
2N
1
2
2 tan 0. 15
2N
1
2
1 and 1
c 0. 89125 c 0. 17783
44
Example Cont’d
• Solve N and c
1
2
1
2
log 1 1
0. 17783 0. 89125
N 5. 305 6 c 0. 766
2 log tan 0. 15 tan 0. 1
• The resulting
sk 1 transfer
1 / 12
j c function
cej / 12 2has
k 11 the following poles
for k 0,1,...,11
0. 20238
Hc s• Resulting in
s2 0. 3996 s 0. 5871 s2 1. 0836 s 0. 5871 s2 1. 4802 s 0. 5871
• Applying
Hz the bilinear transform
0. 0007378yields
1 z 1
6
1 1. 2686 z 1 0. 7051z 2 1 1. 0106z 1 0. 3583z 2
1
1 0.9044z 1
0. 2155z 2
45
Example Cont’d
46
IIR Digital Filter: The bilinear
transformation
Stable Stable
Real and Rational in Real and
z Rational in s
Order n Order n
c L.P. cutoff cT
L.P. (lowpass) cutoff
47
Bilinear Transformation
• Mapping of s-plane into the z-plane
48
Bilinear Transformation
• For z e j with unity scalar we have
j
j 1 e j tan( / 2)
j
1 e
or tan( / 2)
49
Bilinear Transformation
• Mapping is highly nonlinear
• Complete negative imaginary axis in the s-
plane from to 0 is mapped
into the lower half of the unit circle in the z-
1 z 1to
plane zfrom
• Complete positive imaginary axis in the s-
plane from 0 to is mapped into
the upper half of the unit circle in the z-plane
from z 1 toz 1
50
Bilinear Transformation
• Nonlinear mapping introduces a distortion
in the frequency axis called frequency
warping
• Effect of warping shown below
51
Spectral Transformations
• To transform GL (z ) a given lowpass transfer
function to another transfer function GD (zˆ )
that may be a lowpass, highpass, bandpass or
bandstop filter (solutions given by
Constantinides)
• z 1 has been used to denote the unit delay in
1
the prototype lowpass filter GL (z ) and zˆ
to denote the unit delay in the transformed
filter GD (zˆ ) to avoid confusion
52
Spectral Transformations
• Unit circles in z- and ẑ -planes defined by
z e j zˆ e ĵ
,
• Transformation
ẑ from z-domain to
-domain given by
• Then z F (zˆ )
GD ( zˆ ) GL {F ( zˆ )}
53
Spectral Transformations
• From z F (zˆ ) , thusz F (zˆ ) , hence
1, if z 1
F ( zˆ ) 1, if z 1
1, if z 1
• Therefore 1 / F ( zˆ ) must be a stable allpass function
1 L 1 * zˆ
, 1
F ( zˆ ) 1 zˆ
54
Lowpass-to-Lowpass
Spectral Transformation
• To transform a lowpass filterGL (z ) with a cutoff
frequency c to another lowpass filter GD (zˆ )
with a cutoff frequency ̂ c , the transformation is
1 1 zˆ
z 1
F ( zˆ ) zˆ
• On the unit circle we have
jˆ
e e jˆ
j
1 e
which yields
tan( / 2) 1 tan(ˆ / 2)
1 55
Lowpass-to-Lowpass
Spectral Transformation
• Solving we get sin ( c ˆ c ) / 2
sin ( c ˆ c ) / 2
• Example - Consider the lowpass digital filter
0.0662(1 z 1 )3
GL ( z ) 1 1 2
(1 0.2593 z )(1 0.6763 z 0.3917 z )
which has a passband from dc to 0.25 with
a 0.5 dB ripple
• Redesign the above filter to move the
passband edge to
0.35 56
Lowpass-to-Lowpass
Spectral Transformation
• Here sin(0.05 )
0.1934
sin(0.3 )
• Hence, the desired lowpass transfer function is
GD ( zˆ ) GL ( z ) z zˆ 0.1934 1
1
1 0.1934 zˆ 1
-10
Gain, dB
G (z) G (z)
L D
-20
-30
-40
0 0.2 0.4 0.6 0.8 1
w/p
57
Lowpass-to-Lowpass
Spectral Transformation
• The lowpass-to-lowpass transformation
1 1 1 zˆ
z
F ( zˆ ) zˆ
can also be used as highpass-to-highpass,
bandpass-to-bandpass and bandstop-to-
bandstop transformations
58
Lowpass-to-Highpass
Spectral Transformation
• Desired transformation
1
1 zˆ
z
1 zˆ 1
• The transformation parameter is given by
cos( c ˆ c ) / 2
cos( c ˆ c ) / 2
where c is the cutoff frequency of the lowpass filter
and iŝthe
c cutoff frequency of the desired
highpass filter
59
Lowpass-to-Highpass
Spectral Transformation
• Example - Transform the lowpass filter
1 3
0.0662(1 z )
GL ( z )
(1 0.2593 z 1 )(1 0.6763 z 1 0.3917 z 2 )
• with a passband edge at 0.25 to a highpass
filter with a passband edge at 0.55
• Here cos(0.4 ) / cos(0.15 ) 0.3468
• The desired transformation is
1
1 ˆ 0.3468
z
z 1
1 0.3468 zˆ 60
Lowpass-to-Highpass
Spectral Transformation
- 20
Gain, dB
- 40
- 60
- 80
0 0.2p 0.4p 0.6p 0.8p p
Normalized frequency
61
Lowpass-to-Highpass
Spectral Transformation
• The lowpass-to-highpass transformation can
also be used to transform a highpass filter with
a cutoff at c to a lowpass filter with a cutoff
at ̂ c
• and transform a bandpass filter with a center
frequency at o to a bandstop filter with a
center frequency at ̂ o
62
Lowpass-to-Bandpass
Spectral Transformation
• Desired transformation
2 2 1 1
zˆ zˆ
1 1 1
z
1 2 2 1
zˆ zˆ 1
1 1
63
Lowpass-to-Bandpass
Spectral Transformation
• The parameters and are given by
cos(ˆ c 2 ˆ c1 ) / 2
cos(ˆ c 2 ˆ c1 ) / 2
cot (ˆ c 2 ˆ c1 ) / 2tan( c / 2)
where c is the cutoff frequency of the lowpass
filter, and ˆ c1 and ˆ c 2 are the desired upper and
lower cutoff frequencies of the bandpass filter
64
Lowpass-to-Bandpass
Spectral Transformation
• Special Case - The transformation can be
simplified if c ˆ c 2 ˆ c1
• Then the transformation reduces to
1
1 1 ˆ
z
z zˆ 1
1 zˆ
where cos ˆ o with ̂ o denoting the
desired center frequency of the bandpass filter
65
Lowpass-to-Bandstop
Spectral Transformation
• Desired transformation
2 2 1 1
zˆ zˆ
1 1 1
z
1 2 2 1
zˆ zˆ 1
1 1
66
Lowpass-to-Bandstop
Spectral Transformation
• The parameters and are given by
cos(ˆ c 2 ˆ c1 ) / 2
cos(ˆ c 2 ˆ c1 ) / 2
tan (ˆ c 2 ˆ c1 ) / 2 tan( c / 2)
where c is the cutoff frequency of the
lowpass filter, and ˆ c1 and ˆ c 2 are the desired
upper and lower cutoff frequencies of the
bandstop filter
67
UNIT-4
FIR Filters
68
Selection of Filter Type
h[n] h[ N n]
70
Selection of Filter Type
• Advantages in using an FIR filter -
(1) Can be designed with exact linear phase
(2) Filter structure always stable with quantised
coefficients
• Disadvantages in using an FIR filter - Order of an
FIR filter is considerably higher than that of an
equivalent IIR filter meeting the same
specifications; this leads to higher computational
complexity for FIR
71
FIR Filter Design
Digital filters with finite-duration impulse response (all-zero, or FIR filters)
have both advantages and disadvantages compared to infinite-duration
impulse response (IIR) filters.
FIR filters have the following primary advantages:
The primary disadvantage of FIR filters is that they often require a much
higher filter order than IIR filters to achieve a given level of performance.
Correspondingly, the delay of these filters is often much greater than for an
equal performance IIR filter.
FIR Design
FIR Digital Filter Design
Three commonly used approaches to FIR
filter design -
(1) Windowed Fourier series approach
(2) Frequency sampling approach
(3) Computer-based optimization methods
73
Finite Impulse Response Filters
• The transfer function is given by
N1
n
H ( z ) h(n).z
n 0
74
FIR: Linear phase
75
Linear Phase
• What is linear phase?
• Ans: The phase is a straight line in the passband of
the system.
• Example: linear phase (all pass system)
• I Group delay is given by the negative of the slope
of the line
76
Linear phase
• linear phase (low pass system)
• Linear characteristics only need to pertain to
the passband frequencies only.
77
FIR: Linear phase
• For Linear Phase t.f. (order N-1)
• h(n) h( N 1 n)
• so that for N even:
N 1
2 N1
n
H ( z ) h( n).z h( n).z n
n 0 n N
2
N 1 N 1
2 2
h( n).z n h( N 1 n).z ( N 1 n )
n 0 n 0
N 1
2
h( n) z n z m
n 0
m N 1 n
78
FIR: Linear phase
• for N odd:
N1 N 1
1
2
H ( z ) h(n). z
n 0
n
z m
h
N 1
2
z 2
82
Summary of Properties
K
H e j0 e jN / 2 F ak cosk
k 0
Type I II III IV
Order N even odd even odd
Symmetry symmetric symmetric anti-symmetric anti-symmetric
Period 2p 4p 2p 4p
w0 0 0 p/2 p/2
F(w) 1 cos(w/2) sin(w) sin(w/2)
K N/2 (N-1)/2 (N-2)/2 (N-1)/2
H(0) arbitrary arbitrary 0 0
H(p) arbitrary 0 0 arbitrary
Design of FIR filters: Windows
(i) Start with ideal infinite duration h(n)
(ii) Truncate to finite length. (This produces
unwanted ripples increasing in height near
discontinuity.)
(iii) Modify to ~
h (n) h(n).w(n)
Weight w(n) is the window
84
Design of FIR filters: Windows
• Simplest way of designing FIR filters
• Method is all discrete-time no continuous-time involved
• Start with ideal frequency
response
h ne
1
Hd e j
n
d
j n
hd n
2
Hd
e j
e j n
d
• More generally 1 0 n M
hn hd nwn where wn
0 else
85
Properties of Windows
• Prefer windows that concentrate around DC in frequency
– Less smearing, closer approximation
• Prefer window that has minimal span in time
– Less coefficient in designed filter, computationally efficient
• So we want concentration in time and in frequency
– Contradictory requirements
• Example: Rectangular window
1 e j M1 j M / 2 sinM 1 / 2
M
We e
j j n
1 e j
e
sin / 2
n 0
86
Windowing distortion
• increasing window length generally reduces the
width of the main lobe
• peak of sidelobes is generally independent of M
87
Windows
Commonly used windows
•Rectangular 1 N1
2n n
•Bartlett 1 2
N
2n
•Hanning 1 cos
N 2n
•Hamming 0.54 0.46 cos
• N
• Blackman 2n 4n
0.42 0.5 cos 0.08 cos
N N
•
• Kaiser 2 n
2
J 0 1
J 0 ( )
N 1
88
Rectangular Window
• Narrowest main lob
– 4/(M+1)
– Sharpest transitions at
discontinuities in frequency
1 0 n M
w n
0 else
89
Bartlett (Triangular) Window
• Medium main lob
– 8/M
• Side lobs
– -25 dB
• Hamming window
performs better
• Simple equation
2n / M 0 n M / 2
wn 2 2n / M M / 2 n M
0 else
90
Hanning Window
• Medium main lob
– 8/M
• Side lobs
– -31 dB
• Same complexity as
Hamming
1 2n
1 cos 0 n M
wn 2 M
0 else
91
Hamming Window
• Medium main lob
– 8/M
2n
0. 54 0. 46 cos 0 n M
wn M
0 else
92
Blackman Window
• Large main lob
– 12/M
• Complex equation
2n 4n
0. 42 0. 5 cos 0. 08 cos 0 n M
wn M M
0 else
93
Kaiser Window Filter Design Method
• Parameterized equation
forming a set of windows
– Parameter to change main-lob
width and side-lob area trade-off
2
I 0 1 n M / 2
M/ 2
wn 0 n M
I 0
0 else
94
Comparison of windows
95
Kaiser window
• Kaiser window
β Transition Min. stop
width attn dB
(Hz)
2.12 1.5/N 30
4.54 2.9/N 50
6.76 4.3/N 70
8.96 5.7/N 90
96
Example
• Lowpass filter of length 51 and c / 2
Lowpass Filter Designed Using Hann window Lowpass Filter Designed Using Hamming window
0 0
Gain, dB
Gain, dB
-50 -50
-100 -100
-50
-100
Kaiser’s Formula:
20 log10 ( p s ) 13
N 1
14.6(s p ) / 2
• ie N is inversely proportional to transition
band width and not on transition band
location
99