Filter design techniques
In the design of frequency selective filters,
the desired filter characteristics are
specified in the frequency domain in terms
of the desired magnitude and phase
response of the filter
In the filter design process, we determine
the coefficients of a causal FIR or IIR filter
that closely approximate the desired
frequency response specifications
2
Which type of filter is to be used
In general FIR filters are used in filtering
problems where a linear phase is required
IIR filters can be used if linear phase is not
required
In general IIR filter has a lower side-lobes
in the stop band than an FIR having the
same number of parameters
3
Which type of filter is to be used
If some phase distortion is tolerable then
IIR filter is preferable because its
implementation requires fewer
parameters, less memory and lower
computational complexity
A comparison between FIR and IIR filters
is made in the next slide
4
Relation between IIR filter and
the difference equationsThe input output relations of the IIR filter are
governed by the difference equation
π=0
π
πππ¦ π β π =
π=0
π
πππ₯ π β π
The above equations means that we can
compute the filter output if the filter coefficients
ππ and ππ are known
The goal of this section is to determine these
coefficients
6
Relation between IIR filter and
the difference equationsIf we apply the z transform to the LCCD
difference equation which describes the
IIR filter we got the discrete filter system
function given by
π» π§ = π=0π πππ§
βπ
1 + π=1π πππ§
βπ
It can be noticed that π»(π§) is a rational
function
7
Causality and its implications
All ideal filters are non causal
Non causal means that these filters are
not physically realizable
To illustrate this concept let us consider an
ideal low pass filer
The frequency response of the filter is
given by π» π =1 π β€ ππ0 ππ < π < π
8
Causality and its implications
The impulse response of the filter is given
by β π =ππ
π
π πππππ
πππ
Typical plot of the ideal LPF filter for ππ =π
4
is shown below
9
Causality and its implications
From the plot of β[π] it is clear that β π β 0 for π < 0 which means that the filter is
not causal
If the filter is not causal this means that the
filter output samples π¦[π] depends on the
future values of the input π₯[π + 1], π₯[π +2] which is impossible to estimate
10
Processing continuous time
signal with digital filterConsider a discrete-time filter is to be used
to low pass filter a continuous time signal
The complete system may be presented
as shown below
11
Determining specifications for a
discrete time filter
When designing a LPF we need its
magnitude frequency response to be as
shown
12
Design of discrete time IIR filters
from continuous time filters
The traditional approach to design IIR
filters involves the transformation of a
continuous-time filter into a discrete-time
filter meeting prescribed specifications
This design procedure can be achieved by
finding the system function π»π(π ) or the
impulse response of the continuous filter
βπ(π‘)
13
Design of discrete time IIR filters
from continuous time filters
There are four well known analog filters
used in the design of IIR digital filters
these are
Butterworth
Chebyshev I
Chebyshev II
Elliptic
14
Design of discrete time IIR filters
from continuous time filters
The system function π»(π§) or the impulse
response β π for the discrete-time filter is
obtained by using either
Impulse invariance method
Bilinear transformation
15
IIR filter design by Impulse
invarianceIn the impulse invariance method we can
design an IIR filter by sampling the
impulse response of analog filter
according to
β π = ππβπ πππWhere ππ represents the sampling interval
16
IIR filter design by Impulse
invarianceIf the continuous time filter is band limited,
so that
π»π πΞ© = 0 Ξ© β₯π
ππ
π» πππ = π»π(ππ
ππ) π β€ π
17
IIR filter design by Impulse
invariance
The discrete-time filter and the continuous
time filter frequency responses are related
by a linear scaling of the frequency axis
which is given by π = Ξ©ππ for π β€ π
Where π is the discrete frequency axis
and Ξ© is the continuous frequency axis
18
Practical IIR filter and aliasing
Any practical continuous filter can not be
exactly band limited
This means that the sampling process will
cause interference between successive
samples which causes aliasing as shown
19
Practical IIR filter and aliasing
The aliasing problem makes the impulse
invariance method not a suitable method for
the design of high pass filters
However if the continuous time filter
approaches zero at high frequencies, the
aliasing is negligible and can be ignored
20
IIR filter and continuous to discrete
system function transformation
Consider the system function of the
continuous-time filter expressed in terms of
partial fractions as shown below
The corresponding impulse response is
(inverse Laplace transform)
π represents the number
of poles
21
IIR filter and continuous to discrete
system function transformation
The impulse response of the discrete time filter
obtained by sampling ππβπ(π‘) as shown
The system function of the discrete time filter is
22
IIR filter and continuous to discrete
system function transformation
If we compare the system function for both
continuous time π»π π and discrete time π»(π§)system function, we observe that a pole at
π = π π in the S- plane transforms to a pole at
π§ = ππ πππ in the z plane
Also the coefficients in the partial fraction for
both π»π π and π»(π§) are equal, except for the
scaling multiplier ππ
23
IIR filter and continuous to discrete
system function transformation
Note that π π is acomplex number which can be
written as π π = π + ππ this means that π§ =πππππππππ
If the real par of π π is less than zero (π negative),
then π§ < 1 , the corresponding pole in the
discrete time filter falls inside the unit circle
This means that the causal discrete time filter is
stable
24
Example 1
Example 1 convert the analog filter defined
by the system function π»π π =1
(π +0.1)2+9into
a digital IIR filter by means of impulse
invariance method
25
Example1 solution
Solution
Since the filter system function π»π π for the
continuous filter is given we can find
π»(π§) directly through the partial fraction (no
need to go back to the time domain and then
use sampling)
From π»π π we can find that the filter has two
poles located at
π 1 = β0.1 + π3 and π 2 = β0.1 β π3
26
Example1 solution
Solution
If we analyze π»π π by the partial fraction
we get
To find π»(π§) we use the expression
developed in slide 23
27
Example1 solution
If we plot the poles and zeros of the
previous example we can see that π < 0and both poles are located in the left side
of the s plane as shown below
28
Example 1 solution
If we manipulate π»(π§) expression we find that
π»(π§) can be written as
If we compare this expression for π»(π§) with
π» π§ = π=0π πππ§
βπ
1+ π=1π πππ§
βπ we can find the filter
coefficients are
π0 = 1, π1 = βπβ0.1ππcos(3ππ), π0 = 1, π1 =
β 2πβ0.1ππ cos 3ππ , π2 = πβ0.2ππ,
29
2
Example 2
The system function of a discrete time
system is π» π§ =1
1βπβ0.2π§β1+
1
1βπβ0.4π§β1,
determine the filter coefficients
30
Example 2 solution
Note the discrete time system can be
rewritten as π» π§ =2β πβ0.4+πβ0.2 π§β1
1β πβ0.4+πβ0.2 π§β1+πβ0.6π§β2
If we compare this expression for π»(π§) with
π» π§ = π=0π πππ§
βπ
1+ π=1π πππ§
βπ we can find the filter
coefficients are
π0 = 2 , π1 = πβ0.4 + πβ0.2 , π0 = 1 , π1 =
β πβ0.4 β πβ0.2, π2 = πβ0.6
31
Example 3
Design a Butterworth filter whose continuous
frequency response is given by
π»π(πΞ©)2 =
1
1+Ξ©
Ξ©π
2π
using the impulse invariance method
The filter specifications are
32
Example 3 solution
Solution
Since the parameter ππ cancels in the impulse
invariance procedure we can select ππ = 1 ,
therefore Ξ© = π
In order to deign the filter we need to transform
the discrete filter specifications to specifications
on the continuous time filter
33
Example 3 solution
Solution
The continuous time filter specifications became
The filter magnitude at the pass band and stop
band frequencies is given by
34
Example 3 solution
Solution
From the above magnitude conditions, the
magnitude squared of the continuous filter at
both the pass and stop bands is given by
0.89125 2 =1
1+0.2π
Ξ©π
2π
0.17783 2 =1
1+0.3π
Ξ©π
2π
35
Example 3 solution
Solution
If we solve the above two equations for π and
Ξ©π we got π = 5.8858 β 6 and Ξ©π = 0.7032
Since π = 6 then the filter has 12 poles of the
magnitude squared function π»π π π»π βπ =1
1+π
Ξ©π
2π
The poles can easily be found by using the
following matlab commands
36
Example 3 solution
π = 1
b=[68.399 0 0 0 0 0 0 0 0 0 0 0 1]
[π§ π π] = π‘π2π§π(π, π)
37
Example 3 solution
Solution
The poles are uniformly
distributed in angle of360Β°
12= 30Β° on a circle of
radius Ξ©π = 0.7032 as
shown
38
Example 3 solution
Solution
The poles that describe a stable system are
those poles located in the left side of the s-plane
The number of these poles is 6 and one solution
for these poles is on the assumption that the first
pole located a at an angle of 105Β°
39
Example 3 solution
Solution
Now the system function of the continuous time
filter is given by
To find π»(π§) we use the expression developed in
slide 23
40
Example 3 solution
Solution
In order to find the filter coefficients again we need
to write π»(π§) as a rational function and then find
the coefficients as we have did in the previous two
examples
41
Impulse invariance summery
To summarize, the impulse invariance method maps
the s-plane to the z-plane by sampling the impulse
response of continuous (analog) time filter
Impulse invariance suffers from aliasing problem
and therefore is not suitable for HPF design
42
Impulse invariance summery
In order to find the filter coefficients follow these steps
1. find π»π π , expand it in partial fraction, find the poles
of π»π π
2. Next find the discrete system function according to
π» π§ = π=1π πππ΄π
1βππ ππππ§β1
3. Convert π»(π§) to rational function
4. Compare the rational expression for π»(π§) with
π» π§ = π=0π πππ§
βπ
1+ π=1π πππ§
βπ and determine the coefficients
accordingly
43
Bilinear transformation
The bilinear transformation is an algebraic
transformation between the π and π§ planes
Bilinear transformation maps the entire πΞ©-axis in the s-plane to one revolution of the
unit circle in the z-plane
Bilinear transformation avoids the aliasing
problem associated with time invariant
approach
44
Bilinear transformation
The bilinear transformation corresponds to
replacing π by
π =2
ππ
1 β π§β1
1 + π§β1
This means that the discrete and
continuous system functions are related by
π» π§ = π»π2
ππ
1 β π§β1
1 + π§β1
45
Bilinear transformation
To develop the properties of the algebraic
transformation we solve for π§ to obtain
π§ =2
ππ
1 +ππ2π
1 βππ2π
Substituting π = π + ππ, we got
π§ =1 + πππ2+ πΞ©ππ2
1 β πππ2β πΞ©ππ2
46
Bilinear transformation
Again as in the time invariant procedure, if π <0, π§ < 1, for any value of Ξ©
This means the poles fall in the left half of the s-
plane or inside the unit circle of the z-plane,
which means that the system is stable
Similarly if of π > 0, π§ > 1, for any value of Ξ©
The poles fall in the right half of the s-plane or
outside the unit circle of the z-plane, which
means that the system is unstable
47
Bilinear transformation
In order to show that the πΞ©-axis of the s-plane
maps onto the unit circle, substitute π = 0 into
π§ =1+πππ2+πΞ©ππ2
1βπππ2βπΞ©ππ2
and simplify the expression we
got
π§ =1 + πΞ©
ππ2
1 β πΞ©ππ2
Recall that π§ = πππππ = πππ
48
Bilinear transformation
The expression for π =2
ππ
1βπ§β1
1+π§β1can be
rewritten as s =2
ππ
1βπβππ
1+πβππor equivalently
π = π + πΞ© =2
ππ
2πβππ2 sin
π
2
2πβππ2 cos
π
2
=2π
ππtan
π
2
From which we can conclude that
Ξ© =2
ππtan
π
2or π = 2π‘ππβ1
Ξ©ππ
2
49
Mapping between the z-plane
and the s-planeThe properties of the bilinear transformation as
mapping from the s-plane to the z-plane are
illustrated graphically as shown below
50
Axis mapping notes
Note that the Bilinear transformation maps
the range of continuous frequencies 0 β€Ξ© β€ β maps to 0 β€ π β€ π on the discrete
frequency axis
Also the range of continuous frequencies
ββ β€ Ξ© β€ 0 maps to βπ β€ π β€ 0 on the
discrete frequency axis as illustrated in the
next slide
51
Example 1
Design a digital Butter worth low pass
filter whose specifications are
Using the bilinear transformation
53
Example 1 solution
The design procedure starts by reflecting the
specifications of the discrete filter to
specifications of the digital filter as shown
Let ππ = 1
54
Example 1 solution
The magnitude of the filter at the pass
band frequency Ξ©π = 2 tan0.2π
2is given
by
Also note that the magnitude of the filter at
the stop band Ξ©π = 2 tan0.3π
2is given by
55
Example 1 solution
By substituting the values of Ξ©π and Ξ©π in
the magnitude squared of the Butterworth
filter we got the following equations
By solving these two equations for Ξ©π and
π we got π = 5.305 β 6 and Ξ©π = 0.766
56
Example 1 solution
If we plot the poles of π»π π 2 of the filter
we got the following graph
57
Example 2
Design a single pole low pass digital filter
with a 3-dB bandwidth of 0.2π, using the
bilinear transformation applied to the
analog filter defined by π» π =Ξ©π
π +Ξ©πwhere
Ξ©π is the 3-dB bandwidth of the filter
59
Example 2 solution
By using the linear transformation we have
Ξ©π =2
ππtan
0.2π
2=0.65
ππ
The system function of the analog filter can
be written as π» π =
0.65
ππ
π +0.65
ππ
By substituting π =2
ππ
1βπ§β1
1+π§β1, we got the
discrete system function as
60
Example 2 solution
π» π§ =
0.65
ππ
21βπ§β1
1+π§β1+0.65
ππ
= 0.2451+π§β1
1β0.509π§β1
61
IIR filter design in MATALB
We have seen from the previous discussion both
the impulse invariance and bilinear
transformations needs too many computations
A simpler way to design an IIR filter can be done
easily with the aid of MATLAB
It is easy to show this by an example
62
IIR filter design in MATLAB
Design a band pass filter with the following
specifications
Pass band frequencies from 1000 to 2000 Hz
The stop bands starting 500 Hz away on either side
A 10 kHz sampling frequency
At most 1 dB of pass band ripple and at least 60 dB of
stop band attenuation
63
IIR filter design in MATLAB
Solution
In order to design the filter we need to specify its
coefficients
This can be achieved by using the following
statements in MATLAB
ππ = 10 ππ»π§ % Sampling frequency
ππ1 = 1 ππ»π§ % The first band pass frequency
ππ2 = 2 ππ»π§ % The second band pass frequency
ππ 1 = 500 π»π§ % The first stop band frequency
ππ 2 = 2500 π»π§ % The second stop band frequency
64
IIR filter design in MATLAB
π π = 1 ππ΅ % The ripple in the pass band
π π = 60 ππ΅ % The attenuation in the stop band
The filter order and normalized frequencies can be
computed by using the following statement
[π,ππ] = ππ’π‘π‘πππππ1 ππ2
ππ ,ππ 1 ππ 2
ππ , π π, π π
The filter coefficients can be computed from the
following statements
π, π = ππ’π‘π‘ππ π,ππ ;
65
IIR filter design in MATLAB
More examples to design IIR filter is by the use of these
statements [π, π] = ππ’π‘π‘ππ(π,ππ, πππ‘ππππ )
[π, π] = ππ’π‘π‘ππ(5,0.4); % Lowpass Butterworth
[π, π] = πβπππ¦1(π, π π,ππ, πππ‘ππππ )
[π, π] = πβπππ¦1(4,1, [0.4 0.7]); % Bandpass Chebyshev Type I
[π, π] = πβπππ¦2(π, π π ,ππ, πππ‘ππππ )
[π, π] = πβπππ¦2(6,60,0.8, β²βππββ²); % Highpass Chebyshev Type II
[π, π] = πππππ(π, π π, π π ,ππ, πππ‘ππππ )
[π, π] = πππππ(3,1,60, [0.4 0.7], β²π π‘ππβ²); % Bandstop elliptic
66
Filter design in MATLAB
We can design IIR or FIR filters in MATALB
using the filter design and analysis tool
FDATOOL
In the command window of MATLAB type
FDATOOL
A window the filter design window will appear as
shown in the next slide
67
Using FDATOOL
To design a filter, you need to specify the
sampling rate, pass and stop band frequencies
You can also determine the filter type,
implementation, FIR or IIR
Once the filter is designed you can view or
export the filter coefficients to workspace or file
using the command file as illustrated in the next
slide
69