Digital Filters - Implementation and Design: Basic Filtering Operations
Digital Filters - Implementation and Design: Basic Filtering Operations
Digital Filters - Implementation and Design: Basic Filtering Operations
Contents
Reading:
Chapter 7, Proakis and Manolakis
Digital Signal Processing. Slide 4.2
Filter Design
Filter Implementation
Given some filter design, including the type, order and coefficients of the
filter, determine a way of implementing the filtering operation using
appropriate hardware or software.
k =1
k =0
ak y(n k ) + bk x (n k )
or by a system function
H ( z) =
Y ( z)
=
X ( z)
bk z k
k =0
N
ak z k
k =1
x2 ( n)
addition
delay
x1 ( n) + x2 ( n)
x1 (n)
x ( n 1)
x ( n)
z 1
x ( n 1)
ax ( n)
x ( n)
ax (n)
x1 (n)
multiplication
by a constant
x ( n)
x ( n)
x1 ( n) + x2 ( n)
System function
H ( z) =
Difference equation y ( n) =
bk z k
k =0
M
bk x (n k )
k =0
z 1
x ( n)
b( 0)
z 1
z 1
b(1)
b( 2)
b( N 1)
b( N 2)
y ( n)
bk z k
System function
H ( z) =
k =0
N
ak z k
k =1
Difference equation
y ( n) =
k =1
k =0
ak y(n k ) + bk x (n k )
x ( n)
y ( n)
z 1
x ( n 1)
b(1)
a(1)
z 1
y( n 1)
z 1
x ( n 2)
b( 2)
a( 2)
z 1
y ( n 2)
b( M 1)
a ( N 1)
x (n M + 1)
z 1
x (n M )
a( N )
b( M )
y( n N + 1)
z 1
y(n N )
x ( n)
a(1)
a( 2)
z 1
z 1
a ( N 1)
a( N )
y ( n)
b(1)
b( 2)
b( M 1)
z 1
b( M )
Canonical Form
Filter structures which have the minimum number of delay elements are
said to be in canonical form
i.e., minimum number of branches labelled z 1
Minimum number of delays given by maximum of (M, N)
Many other filter structures can be obtained by reformulating the difference equations
two forms will be studied in this course: transposed form and linear phase
FIR
many other forms will not be studied, e.g., cascade form, parallel form etc.
Transposed Forms
b( 0)
y(n)
z 1
z 1
z 1
b(1)
z 1
a(1)
b( 2)
a( 2)
b ( M 1)
a ( N 1)
b( M )
a( N )
z 1
z 1
H ( z) =
=
N 1
h(n)z n
n=0
( N 2 ) 1
h(n)[ z n + z ( N 1 n) ] , N even
n=0
[( N 1)/ 2 ]1
n=0
and hence
( N / 2) 1
N 1
H ( e j ) = e j [( N 1) / 2 ] 2h( n) cos n
, N even
2
n = 0
( N 3) / 2
N 1
j [( N 1) / 2 ] N 1
=e
, N odd
+ 2h( n) cos n
h
2
2
n=0
Digital Signal Processing. Slide 4.15
FIR
9 Linear Phase
constant group delay at any
frequency
9
9
IIR
9 based on well-known analogue
8
concepts
Non-linear phase
delay varies with frequency
This results in
Example
H ( z) =
1
1 + 0.9 z 1
input signal
x ( n) = 10 ( n)
ideal response
y (n) = 10(0.9) n
actual response for integer rounding of arithmetic
y( n) = x( n) 0.9 y( n 1)
= {10,9,8,7,6,5,5,5,5,5, etc }
This is called a limit cycle.
The pole has effectively moved
from z = 0.9 to z = 1 .
The result is oscillation at f s 2 .
Bandpass
( )
Highpass
H e j
( )
Bandstop
H e j
( )
H e j
( )
H e j
Filter Specification
stopband gain
cutoff frequency
transition bandwidth
Digital Signal Processing. Slide 4.21
Order determination
order is
proportional to stopband attenuation
inversely proportional to transition bandwidth
often determined by approximate rule
N 1
h(n) z n
n=0
if we know the impulse response of the required filter then we can easily
design the filter
Digital Signal Processing. Slide 4.22
H d ( e j ) =
hd ( n) =
hd (n)e jn
n =
1
2
Hd (e
) e jn d
The coefficients of an ideal FIR filter can therefore be found from the
Fourier Series coefficients of the desired frequency response.
Frequency Sampling
the truncated impulse response can be obtained directly from the DFT of
the desired frequency response
H ( k ) = Hd (e
2
k
N
h(n) =
N 1
h(n)e
2
nk
N
k = 0,1,2 ,..., N 1
n=0
N 1
H ( k )e
2
nk
N
n = 0,1,2 ,..., N 1
k =0
Example
1,
< 2
H ( e j ) =
0, otherwise
Lowpass filter
Number of taps: 33
desired response
H d ( e j )
0.8
0.6
frequency sampled
response
0.4
0.2
0
0
10
12
14
16
sin( n 2 )
1 2 jn
e
d = 1 2
n 2
2 2
n = ,...,
33 k = 0
h(n)
0.5
0.4
0.3
0.2
0.1
-0.1
10
15
20
25
30
35
Windowing
1,
w(n) =
0,
0 n N 1
otherwise
10
0
Magnitude Response dB
-10
-20
-30
-40
-50
-60
0
0.1
0.2
0.3
Normalized Frequency
0.4
0.5
Hamming window
n
0.54 + 0.46 cos
,
w(n) =
I
0,
I n I
otherwise
Hanning window
n
0.5 + 0.5 cos
,
w(n) =
I
0,
I nI
otherwise
(Several others)
Square
0
Magnitude Response dB
-20
-40
Hamming
-60
-80
-100
-120
0
Hanning
0.1
0.3
0.2
Normalized Frequency
0.4
0.5
Butterworth Filters
H ( j ) =
1+
= 1,
=1
2N
for = 0
2 , for = c
1 N , for >> c
Transformation to discrete-time
wish to map j axis of the s-plane to the unit circle of the z-plane
wish to map poles and zeros on the left half plane of s-plane to the inside
of unit circle in z
j
s = j
s-plane
z = 1
Im
z-plane
Re
Impulse-Invariant
Transformation
Bilinear Transformation
Widely used
Avoids aliasing problem of impulse-invariant
transformation
Two elements
z 1
z +1
transformation
s=
frequency warping
= tan( 2)
From
s=
z 1
z +1
we can write
z=
1 + s 1 + + j
=
= re j
1 s 1 j
> 0 r >1
right half plane of s maps to exterior of unit circle in z
< 0 r <1
left half plane of s maps to interior of unit circle in z
= 0r =1
imaginary axis in s maps to unit circle in z
Example
Design a 2nd order Butterworth digital filter with cutoff frequency of 2 kHz
and sampling frequency 20 kHz.
Apply transformation
s
0.325
0106
.
H ( s) = 2
s + 0.46s + 0106
.
s=
z 1
z +1
H ( z) =
0.068z 2 + 0136
. z + 0.068
. z + 0.413
z 2 1142