Digital Signal Processing
Design of Digital Filters
Digital Filters FIR or IIR
FIR finite impulse response
Linear phase in pass band
Flexible in filter type, from low-pass to hilbert
transform
Stable
IIR infinite impulse response
Nonlinear phase in pass band
Fewer coefficients than FIR for same stop band
attenuation
c = /4
Ideal lowpass filter
H () = 1, c
0, c <
Impulse response
c
n=0
,
h(n) = sin n
c
c
n , n0
c
Causality Considerations
PaleyWiener Theorem
The necessary and sufficient condition forH ()to be the amplitude
response for a realizable causal filter is
lnH ()
d<
1+
Conditions for causality :
(a) H () can be zero at a finite set of frequencies
but not over a range of frequencies
(b) H () cannot be constant over a range of frequencies
(c) H () cannot have any abrupt change
Realizable Filters
Realizable filters can be represented as LTI systems
N
M 1
k =1
k =0
y (n) = a k y (nk ) +
bk x (nk )
which has the frequency response
M 1
b k e j k
H () =
k =0
N
1+ a k e j k
k =1
Characteristics for a Practical Frequency Selective Filter
FIR Example
An averaging filter
n=0, 1, 2
h(n) = 1,
0,
otherwise
systemoutput equation
y ( n) = h(k ) x (nk ) = x (n)+ x (n1)+ x (n2)
k =0
Frequency response
2
H () = h(n)e
n=0
j
jn
= 1+e
= e ( e j +1+e j )
= ( 1+2 cos ) e j
the magnitude
M () = H () =1+2 cos
and linear phase
() =
j2
+e
Averaging Filter
the magnitude
M () = H () =1+2 cos
and linear phase
() =
Pole Zero Plot for Averaging Filter
ztransform of the system function
2
1+
z
+
z
1
2
H ( z ) = 1+ z + z =
2
z
Design FIR Filters
FIR filter of length M
y (n) = b0 x (n)+b1 x (n1)++b M 1 x (nM +1)
M 1
bk x(nk )
k =0
in terms of the convolution of the system impulse response with the input
M 1
y (n) =
h( k ) x (nk )
k =0
therefore
bk = h(k ) , k =0,1, , M 1
the FIR system function is
M 1
H ( z) =
h(k ) zk
k =0
the M 1 roots of the system function are the zeros of the filter
FIR filter has linear phase if
h(n) = h(M 1n) , n=0,1, ,( M /2)1, M even
n=0,1, ,( M 1)/ 2, M odd
Design FIR Filters
Then
M 1
H ( z) =
h(k ) zk
k =0
H ( z) = h (0)+ h(1) z1 +h (2) z2 ++h( M 2) z( M 2)+h (M 1) z(M 1)
=z
( M 1)/ 2
{(
M 1
h
+
2
(M /2)1
=z
( M 1)/ 2
( M 3)/ 2
h( k ) [ z ( M 12k)/ 2 z(M 12k)/ 2 ] ,
k =0
h(n) [ z (M 12k)/ 2 z( M 12k)/ 2 ] ,
k =0
Substitute z1 for z and multiply both sides by z( M 1)
M odd
M even
Design FIR Filters
With symmetry(antisymmetry) conditions
z( M 1) H ( z1 ) = H ( z )
roots of H ( z) are the same as the roots of H ( z1 )
roots ( zeros) of H ( z)occur in complexconjugate pairs
*
if H ( z) has zeros at z 1, z 1 , then it also has zeros at 1/ z 1 ,1/ z 1
Design FIR Filters
When h(n) = h( M 1n)
H () = H r () e j (M 1)/ 2
where H r ()is a real function
M 1
H r () = h
+2
2
( M 3)/ 2
n=0
( M )/ 21
=2
h(n)cos
n=0
M 1
h(n)cos
n ,
2
M 1
n ,
2
phase for both M odd and even
M 1
,
if H r ()>0
2
() =
M 1
+ , if H r ()<0
2
(
(
)
)
M odd
M even
FIR Design By Windowing
Start with a desired frequency response H d ()
H d () = hd (n)e j n
n=0
where
1
h d (n) =
H d () e j n d
2
truncate h d (n) with a windowing function
for example the rectangular window is
w (n) = 1, n=0,1, , M 1
0, otherwise
the FIR filter is
h (n) , n=0,1, , M 1
h(n) = hd (n) w (n) = d
0,
otherwise
FIR Design By Windowing
the Fourier transform of the window w(n)is
M 1
W () =
w (n)e j n
n=0
the frequency response of the(truncated ) FIR filter is
1
H () =
H d ( )W () d
FIR Design By Windowing
Oppenheim & Schafer. Discrete-Time Signal Processing. 3ed. Pearson, 2010.
Hanning window impulse response
h(n) =
1
2n
1 cos
2
M 1
))
Hamming windowimpulse response
h(n) = 0.54 0.46 cos
2 n
M 1
))
Blackman window impulse response
h(n) = 0.42 0.5 cos
2n
4n
+ 0.8 cos
M 1
M 1
))
Window Type
Transition
Width
Peak sidelobe
(dB)
Rectangular
4/M
-13
Bartlett
8/M
-25
Hanning
8/M
-31
Hamming
8/M
-41
Blackman
12/M
-57
Design of Linear-Phase FIR by Frequency-Sampling
1, k =0, 1, 2, 3
2k
Hr
= 0.4, k =4
15
0, k =5, 6, 7
( )
Design of Linear-Phase FIR by Frequency-Sampling
Design of Linear-Phase FIR by Frequency-Sampling
Design of Optimum Equiripple Linear-Phase FIR Filters
Case 1 : Symmetric unit sample response with M odd .
h(n) = h( M 1n)
Case 2 : Symmetric unit sample response with M even .
h(n) = h( M 1n)
Case 3: Antisymmetric unit sample response with M odd .
h(n) = h(M 1n)
Case 4 : Antisymmetric unit sample response with M even .
h(n) = h(M 1n)
Design of Optimum Equiripple Linear-Phase FIR Filters
Case 1 : Symmetric unit sample response with M odd .
h(n) = h( M 1n)
real valued frequency response characteristic H r ()is
M 1
H r () = h
+2
2
( M 3)/ 2
n=0
M 1
h(n)cos
n
2
let k = (M 1)/2n and define {a ( k )}
{(
M 1
,
k =0
2
a (k ) =
M 1
M 1
2h
k , k =1, 2, ,
2
2
h
then
(M 1)/ 2
H r () =
k =0
a (k )cos k
Design of Optimum Equiripple Linear-Phase FIR Filters
H r () for all 4 cases
H r () = Q () P ()
where
1
Q () = cos(/ 2)
sin
sin (/ 2)
and
Case 1
Case 2
Case 3
Case 4
P () = ( k )cos k
k =0
where
( M 1)/ 2
L = ( M /2)1
( M 3)/ 2
Case 1
Case 2 and 4
Case 3
Design of Optimum Equiripple Linear-Phase FIR Filters
In addition to H r () = Q() P ()
define a real valued desired frequency response H dr ()
where
passband
H dr () = 1
0 stopband
and define a weighing function
W () = 2 /1, in the passband
1,
in the stopband
then the weighted error between H dr and H r is
E () = W ()[ H dr () H r ()]
= W ()[ H dr () Q () P ()]
H dr ()
= W () Q()
P ()
Q()
()[ H
dr ()P ()]
=W
where
dr () = H dr ()/ Q()
W () = W ()Q () and H
Design of Optimum Equiripple Linear-Phase FIR Filters
Given E () the Chebyshev approximation is
min[ (k )] [ max S E ()] =
[ [
dr () (k )cos k
min[ (k )] max S W () H
k =0
] ]
where S is the disjoint set of frequencies bands for optimization
Alternation Theorem
A necessary and sufficient condition for
L
P () = ( k )cos k
k =0
dr () in S
to be the best weighted Chebyshev approximation to H
is that E ()have L+2 extremal frequencies in S
then
E (i ) = E (i +1 ) where 1 < 2 < < L+ 2
and
E (i )=max S E () i=1, 2, , L+2
Example 10.2.4
Lowpass, M=101, fp=0.1, fs=0.15
remez (n , f , a , w)
n=60 ;
f =[0, 0.2, 0.3, 1] ;
a=[1, 1, 0, 0] ;
w=[1, 10];
Design of IIR Filters from Analog Filters
Start with a known analog filter as a transfer function
M
k s k
H a (s) =
B (s) k =0
= N
A(s)
k s
k =0
in terms of its impulse response
H a (s) = h(t ) e
st
dt
or as a constant coefficient differential equation
N
k
M
k
d y (t )
d x(t)
k dt k = k dt k
k =0
k =0
For stability :
1. The j axis in the s plane map into the unit circle in the z plane.
2.The LHP of the s plane map into the insided of the unit circle
in the z plane.
IIR Filter Design by Approximation of Derivatives
first derivative
1z1
s=
T
also can show
1
1z
2
s =
T
and the k th derivative
k
1z 1
k
s =
T
thus
H ( z) = H a ( s)| s=(1 z
)/ T
IIR Filter Design by Impulse Invariance
Design IIR filter with unit sample response , h(n) ,that is the sampled
analog impulse response
h(n) h(nT ) ,
n=0,1,2,
sampling in time domain periodically extends the function in
the frequency domain
H ( f ) = Fs
k =
therefore
H () = F s
H ( T ) =
H a [( f k ) F s ]
k =
1
T
H a [(2 k ) F s ]
k =
Ha
2k
T
H (T ) will be aliased unless T is sufficiently small
H ( z)| z=e
sT
1
=
T
k =
H a s j
2k
T
Example 10.3.3
Convert
s+0.1
0.5
0.5
=
+
2
s+0.1 j3 s+0.1+ j3
(s+0.1) +9
into a IIR filter with impulse invariant method.
Solution
0.5
0.5
H ( z) =
+
1+ e 0.1T e j3 T z 1 1+e 0.1 T e j3T z1
1(e0.1 T cos 3 T ) z1
=
0.1 T
1
0.2 T 2
1(2 e
cos 3 T ) z +e
z
H a (s) =
Pole-zero Plot for Analog Filter in Example 10.3.3
Example 10.3.3
IIR Filter Design by the Bilinear Transformation
Bilinear transformation(conformal mapping ) maps s plane to z plane
maps s plane j axis onto the unit circle in the z plane
one-to-one mapping of all points in LHP from s plane
into the unit circle
Bilinear Transformation
2 1z1
s=
T 1+z 1
Mapping Between Continuous and Discrete Domain Frequencies
Example 10.3.4
Convert analog filter
s+0.1
H a (s) =
2
(s+0.1) +16
with resonant frequency r =4
to a digital filter with resonant frequency r = / 2
Solution
from frequency wraping
2
1
= tan
T=
T
2
2
and
1z1
s=4
1
1+ z
yielding
1
2
0.125+0.0061 z 0.1189 z
H ( z) =
2
1+0.9512 z
j / 2
filter poles at p 1,2 = 0.987 e
zeros at z 1,2 = 1, 0.95
( )