Filter Design

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

FIR and IIR Filter Design

DIGITAL FILTER SPECIFICATION


Digital Filter designed to pass signal components
of certain frequencies without distortion.
The frequency response should be equal to the
signal’s frequencies to pass the signal.
(passband)
The frequency response should be equal to zero
to block the signal. (stopband)
DIGITAL FILTER SPECIFICATION
4 Types
DIGITAL FILTER SPECIFICATION
The magnitude response specifications are given some
acceptable tolerances.
DIGITAL FILTER SPECIFICATION
Transition band is specified between the passband and
the stopband to permit the magnitude to drop off
smoothly.
In Passband
1 p G (e j ) 1 p , for p

In Stopband
G (e j ) s , for s

Where p and s are peak ripple values, p are passband


edge frequency and s are stopband edge frequency
DIGITAL FILTER SPECIFICATION
Digital filter specification are often given in
terms of loss function,
A ) = -20 log10 |G(e )|
Loss specification of a digital filter
Peak passband ripple, p = -20 log10 (1 – p) dB
Minimum stopband attenuation, s = -20 log10 ( s) dB
DIGITAL FILTER SPECIFICATION
The magnitude response specifications may be
given in a normalized form.
DIGITAL FILTER SPECIFICATION
Example 1
The peak passband ripple p and the minimum
stopband attenuation s of a digital filter are,
respectively 0.1 dB and 35 dB. Determine their
corresponding peak ripples values p and s.
DIGITAL FILTER SPECIFICATION
The passband and stopband edge frequencies, in
most applications are specified in Hz
2 Fp
2 F pT
p
p
FT FT
2 Fs
s
s
2 FsT
FT FT

Where FT denote the sampling frequency in Hz, Fp


and Fs denote, respectively, the passband and
stopband edge frequencies in Hz
SELECTION OF FILTER TYPE
Objective of digital filter design is to develop a
causal transfer function meeting the frequency
response specification.
For IIR digital filter design
1 2 M
p0 p1 z p2 z pM z
H ( z) 1 2 N
d 0 d1 z d2 z dN z
H(z) must be a stable function, N must be of lowest
order.
SELECTION OF FILTER TYPE
For FIR digital filter design
N
H ( z) h[n]z n

n 0

The degree N of H(z) must be small, for a linear


phase, FIR filter coefficient must satisfy the constraint

h[n] h[ N n]
IIR DIGITAL FILTER DESIGN
Convert the digital filter specifications into analog
lowpass prototype filter specifications
Determine the analog lowpass filter transfer function
to meet these specifications
Then transform it into the desired digital filter
transfer function
Why used this approach?
Analog approximation techniques are highly advanced
Usually yield closed-form solutions
Extensive tables are available for analog filter design.
Many applications require the digital simulation of analog
filters.
IIR DIGITAL FILTER DESIGN
Pa ( s) P( z)
H a ( s) G( z)
Da ( s ) D( z )
A mapping from s-domain to z-domain
The imaginary (j ) axis in s-plane be mapped
onto the unit circle of z-plane
A stable analog tranfer function be transform into
a stable digital transfer function
The most widely used transformation is the
bilinear transformation.
IIR ANALOG FILTER ORDER
ESTIMATION
Selectivity parameter
p
k
s

p and s passband and stopband edge frequencies


Discrimination parameter
2
1 p 1
d 2
or
s 1 A2 1
Where p and s are peak ripple values
IIR ANALOG FILTER ORDER
ESTIMATION
3 dB cutoff frequency, c
1 1
2 2
p [(1 p ) 1] 2N
c s [( s ) 1] 2N
IIR ANALOG FILTER ORDER
ESTIMATION
Butterworth Filter
Magnitude response
2 1
Ha ( j ) 2N

1
c

The Filter order, N

1 log10 A2 1 2
log10 d
N
2 log10 s p log10 k
N
p
with
c
IIR ANALOG FILTER ORDER
ESTIMATION
The magnitude of Butterworth Low-Pass Filter can
also be defined as:
|Ha(j )|2 = Ha(s)Ha(-s)|s=j
Thus,
Ga(s) = Ha(s)Ha(-s)|s=j = 1 / [1+(s/j c)2N]
= |Ha )|2 = 1 / [1+(s/ c)2N]
The poles of Butterworth Low-Pass Filter can also
be defined as:
sk = c ej[ /2 + (2k + 1) /2N], k = 0,1,…N-1
Thus, the Transfer Function is defined as:
Ha(s) = 1 / [sN + a1sN-1 + … + aN-1s + aN]
IIR ANALOG FILTER ORDER
ESTIMATION
Example 2:
Design the Butterworth Low-Pass Filter to meet
the following specification:
fp = 6 kHz, fs = 10 kHz, p = s = 0.1
IIR ANALOG FILTER ORDER
ESTIMATION
Chebyshev Type I
Magnitude response
2 1
Ha ( j ) 2 2
1 TN ( p )

Where the parameter that control the passband ripple can be


defined as

2 1
2
1
1 p
IIR ANALOG FILTER ORDER
ESTIMATION
Chebyshev Type I
Where the chebyshev polynomial of order N, TN ) is :
cos( N cos 1 ), 1
TN ( )
cosh( N cosh 1 ), 1

Can also be derived via a recurrence relation


Tr ( ) 2 Tr 1 ( ) Tr 2 ( ), r 2
with T0 ( ) 1 and T1 ( )

Filter order, N
cosh 1 (1 d )
N
cosh 1 (1 k )
IIR ANALOG FILTER ORDER
ESTIMATION
Example 3
Design a lowpass Chebyshev Type 1 filter to meet
the following spec:
fp = 6 kHz, fs = 10 kHz, p = s = 0.1
IIR ANALOG FILTER ORDER
ESTIMATION
Solution
1. Calculate d & k,
d = sqrt[((1- p)-2 -1)/ ( s
-2 – 1)] = 0.0487
k= p/ s= 0.6
2. Calculate the Filter Order, N
N cosh-1 (1/d) / cosh-1 (1/k) 3.38 = 4
3. Calculate passband ripple controller,
= [(1- p)-2 – 1]1/2 = 0.4843
4. Calculate Nth order Chebyshev Polynomials,
T4 )=8 4– 8 2 -1, -1 x 1
5. The magnitude of the Frequency response of the filter:
|Ha )|2 = 1 / [1 + 2T 2
N P)] =
= 1 / [1 + (0.4843)2 /(12000 )]
= 1 / [1 + 6.22x10-6 ]
IIR ANALOG FILTER ORDER
ESTIMATION
Chebyshev Type II
Magnitude response
2 1
Ha ( j ) 2
2 TN ( p)
1 s

TN ( s )

The order is determine as Type I


BILINEAR TRANSFORMATION
A method to map the left half s-plane to inside
unit circle of z-plane
The design of the digital IIR Filter, H(z) from
analog filter, Ha(s) require a mapping of s-plane
to z-plane.
The point in the left half s-plane should map to
points inside the unit circle to preserve the
stability of the analog filter
BILINEAR TRANSFORMATION
Bilinear transformation is given by
1
2 1 z
s 1
T 1 z
Maps a single point in the s-plane to a unique point in
z-plane
The relationship
G( z ) H a (s) s 2 1 z 1
T 1 z 1
BILINEAR TRANSFORMATION
For s = o +j o,
1 T
2 ( o j o) (1 T
2 o) j T2 o
z
1 T
2 ( o j o) (1 T
2 o) j T2 o

Mapping of s-plane to z-plane


BILINEAR TRANSFORMATION
A point on the j -axis in the s-plane is mapped
onto a point on the unit circle in the z-plane
A point in the left-half s-plane with < 0 is
mapped inside the unit circle in the z-plane
A point in the right-half s-plane with > 0 is
mapped outside the unit circle in the z-plane
Frequency wrapping,
2
tan
T 2
SIMPLIFIED BILINEAR
TRANSFORMATION
Choose T = 2 to simplify the design procedure.
So the parameter T has no effect on G(z)

1 s
z
1 s
BILINEAR TRANSFORMATION
Example 4
Design the Digital Low-Pass Filter with 3-dB Cut-Off
Frequency, c = 0.25 by using Bilinear Transformation
method to analog Butterworth Low-Pass Filter defined below:
Ha(s) = [1 / 1 + (s/ s)]

Example 5
Determine the Low-Pass Digital Filter with 3-dB Cut-Off
Frequency of 0.2 and its Frequency
Response from the analog filter given below:
Ha(s) = c / s + c
where c is the 3-dB Cut-Off Frequency.
DESIGN OF LOW-ORDER DIGITAL
FILTERS
First-order Butterworth lowpass digital filters
Analog transfer function

H LP ( s ) c
s c

Applying bilinear transformation,


1
cT
(1 z )
GLP ( z ) c 2
s c (1 z 1 ) 2cT (1 z 1 )
1
s 2 1 z
T 1 z 1

1 1 z1 1 tan( T 2)
where c
2 1 z1 1 tan( c T 2)
DESIGN OF LOW-ORDER DIGITAL
FILTERS
First-order Butterworth highpass digital filters
Analog transfer function
s
H HP ( s )
s c

Applying bilinear transformation,

s 1 1 z 1
GHP ( z )
s c 2 1 z1
1
s 2 1 z
T 1 z 1
DESIGN OF LOW-ORDER DIGITAL
FILTERS
Second-order bandpass digital filter
Bs 1 1 z 2
H BP ( s) 2 2
GBP ( z )
s Bs o 2 1 (1 ) z 1 z 2

where
1 tan( B T 2)
, cos( oT )
1 tan( B T 2)

Second-order bandstop digital filter


2
s2 1 1 2 z 1 z 2
H BS ( s ) o
2
GBS ( z )
s2 Bs o 2 1 (1 ) z 1 z 2
DESIGN OF LOWPASS IIR DIGITAL
FILTERS
Design a lowpass IIR digital filter with
following parameters
Passband edge frequency, p = 0.25
Passband ripple, p not exceeding 0.5dB
Minimum stopband attenuation, s = 15dB
Stopband edge frequency, s = 0.55
SPECTRAL TRANSFORMATION
Used to modify the characteristic of a filter to
meet the new specifications without repeating
the filter design procedure
For a lowpass filter with a passband edge at 2
kHz, the passband edge can be move to 2.1 kHz.
A digital filter with highpass, bandpass or
bandstop characteristic can also be design by
transforming a given lowpass digital lowpass
filter.
FIR DIGITAL FILTER DESIGN.
Causal FIR transfer function of length M+1
M
1
H ( z) h[n]z
n 0

Corresponding frequency response


M
H (e )
j
h[n]e j n

n 0

FIR Lowpass Filter Impulse response


sin n
hLP [n] c
n
FIR FILTER WITH WINDOW METHOD
An Ideal Frequency Response of Low-Pass Filter
and Impulse Response are shown below:
FIR FILTER WITH WINDOW METHOD
How the Impulse
Response of the ideal
Low-Pass Filter is
windowed is shown
below:
FIR FILTER WITH WINDOW METHOD
The Filter is designed by windowing the impulse
response:

h(n) = hd(n)w(n)

w(n) is a finite-length window that is equal to


zero outside the interval of 0 n M.

M is the Filter order


FIR FILTER WITH WINDOW METHOD
Basically, there are 4 type of window :
Rectangular
w(n) = 1, 0 n M
0, elsewhere
Hanning
w(n) = 0.5 -0.5cos(2 n/M), 0 n M
0, elsewhere
FIR FILTER WITH WINDOW METHOD
Hamming
w(n) = 0.54 – 0.46cos(2 n/M), 0 n M
0, elsewhere

Blackman
w(n) = 0.42 - 0.5cos(2 n/M) +
0.08cos(4 n/M), 0 n M
0, elsewhere
FIR FILTER WITH WINDOW METHOD
The relationship between the length of window,
M and Filter Transition Band is shown below:

=c

c is a parameter of the window.


Transition Band width
s p
FIR FILTER WITH WINDOW METHOD
The window parameter, c is shown below:

1. Rectangular
M = 0.9 , s = -21 dB

2. Hanning
M = 3.1 , s = -44 dB

3. Hamming
M = 3.3 , s = -53 dB

4. Blackman
M = 5.5 , s = -74 dB
FIR FILTER WITH WINDOW METHOD
The diagram of Rectangular, Hanning, Hamming
& Blackman is shown below:
KAISER WINDOW METHOD
The Kaiser window is defined as
I0 1 [( n ) ]2
w[n] , 0 n M
I0 ( )
0, otherwise
Where = M/2, M is the filter order, is the shape
parameter and I0(µ) represents the zeroth-order
modified Bessel Function of the first kind.
2
2
r
I0 ( ) 1
r 1 r!
KAISER WINDOW METHOD
Shape parameter,
0.1102( s 8.7), s 50
0.5842( s 21) 0.4 0.07886( s 21), 21 s 50
0, s 21

Transition Band width


s p

The filter order


s 8
M
2.285( )
KAISER WINDOW METHOD
Example 6
Design a FIR Lowpass with the desired
specification as follows using Kaiser window:
Passband edge, p = 0.3
Stopband edge, s = 0.5
Minimum stopband attenuation, s = 40 dB

You might also like