chapter 3_ iir filters - digital filter design
TRANSCRIPT
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
1/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/
TOC Chapter 1 Chapter 2 Chapter 3
Digital Filter Design
Chapter 3: Infinite Impulse Response (IIR) Filters
3.1. Introduction3.2. IIR filter design
3.3. Reference analog prototype filter
3.4. Analog prototype filter to analog filter transformation
3.5. Bilinear transformation
3.6. Examples
3.1 Introduction
IIR filters are digital filters with infinite impuls e response. Unlike FIR filters, they have the feedback (a recursive part of a filter) and are
known as recursive digital filters therefore.
Figure 3-1-1. Block d iagrams of FIR and IIR filters
For this reason IIR filters have much be tter frequency response than FIR filters of the sam e order. Unlike FIR filters, their phase
characteristic is not linear which can cause a problem to the systems which need phase linearity. For this reas on, it is not preferable to
use IIR filters in digital signal processing when the phase is of the essence.
Otherwise, when the linear phase characteristic is not important, the use of IIR filters is an excellent solution.
There is one problem known as a potential instability that is typical of IIR filters only. FIR filters do not have such a p roblem as they do not
have the feedback. For this reason, it is always necessary to check after the design process whether the resulting IIR filter is stable or not.
IIR filters can be designed using different methods. One of the most comm only used is via the reference analog prototype filter. This
method is the best for designing all standard types of filters such as low-pass , high-pass, band-pass and band-stop filters.
This book des cribes the des ign method us ing reference analog prototype filter. Figure 3-1-2 illustrates the block diagram of this m ethod.
Figure 3-1-2. Block diagram of design method using reference analog prototype filter
FIR filters can have linear phase characteristic, which is not typical of IIR filters. When it is necess ary to have linear phas e characteristic,
Featured Development Tools
dsPICPRO4 Development
System
The dsPICPRO4 supports the latest 64-
and 80-pin dsPIC30F microcontrollers
from Microchip. It comes w ith a
dsPIC30F6014A. The system includes an
USB 2.0 programmer, mikroICD (In-Circuit
Debugger), touch panel c ontroller, CAN,
RS485, DAC and RTC. [more info]
EasydsPIC4A Development
System
EasydsPIC4A is a full-featured
development sys tem that supports the
latest 18-, 28- and 40-pin dsPIC30F
MCUs. It comes w ith the dsPIC30F4013
microcontroller. The board features a
USB 2.0 programmer, mikroICD (In-Circuit
Debugger), touch panel controller etc.
[more info]
Login | Cart (0)
Products Solutions Store Distributors Libstock Contact Us search here
http://www.mikroe.com/products/view/313/easydspic4a-development-system/http://www.mikroe.com/visitor_contacts/http://www.libstock.com/http://www.mikroe.com/distributors/http://www.mikroe.com/store/http://www.mikroe.com/http://www.mikroe.com/carts/mini/http://www.mikroe.com/users/login/http://www.mikroe.com/products/view/313/easydspic4a-development-system/http://www.mikroe.com/products/view/313/easydspic4a-development-system/http://www.mikroe.com/products/view/313/easydspic4a-development-system/http://www.mikroe.com/products/view/40/dspicpro4-development-system/http://www.mikroe.com/products/view/40/dspicpro4-development-system/http://www.mikroe.com/products/view/40/dspicpro4-development-system/http://www.mikroe.com/chapters/view/73/chapter-3-iir-filters/http://www.mikroe.com/chapters/view/72/chapter-2-fir-filters/http://www.mikroe.com/chapters/view/71/chapter-1-basic-concepts-of-digital-filtering-and-types-of-digital-filters/http://www.mikroe.com/products/view/268/digital-filter-design/ -
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
2/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 2
FIR filters are the only available solution. In other cases when linear phase characteristic is not necess ary, such as speech s ignal
process ing, FIR filters are not good sol ution. IIR filters s hould be us ed instead. The resulting filter order is cons iderably lower for the sam e
frequency respons e.
The filter order determines the number of filter delay lines, i.e. number of input and output samples that should be s aved in order that the
next output sample can be computed. For instance, if the filter order is 10, it means that it is neces sary to save 10 input samples plus 10
output samples preceeding the current sample. All these 21 sam ples will affect the next output sample.
The IIR filter transfer function is a ratio of two po lynomials of com plex variable z-1. The numerator defines location of zeros, whereas the
denominator defines location of poles of the resulting IIR filter transfer function.
Figure 3-1-3. illustrates input and output signals of the system with non-linear phase characteristic.
Figure 3-1-3. The effect of non-linear phase characteristic
The system introduces phas e shift of 0 radians at frequency of , and radians at three times hi gher frequency. Input signal consis ts of
nature frequency and harmonics with the same am plitude at three times higher frequency. Figure on the left illustrates an input s ignal,
whereas Figure on the right illustrates an output signal. As seen, these two signals have different waveforms. Neither the power of the
signal nor am plitudes of particular harmonics have been changed, but the phase of the second harm onic.
Assum e that an input represents a speech s ignal where the phas e is not important. In this case s uch phas e dis torsion would be
negligable as the system satisfies the s tated requirements. Otherwise, if the phase is important, such a huge distorsion m ustnt be
allowed.
3.2 Infinite impulse response (IIR) filter design
The most comm only used IIR filter design method uses reference analog prototype filter. It is the best method to use when des igning
standard filters such as low-pass, high-pass, bandpass and band-stop filters.
The filter design process starts with s pecifications and requirem ents of the desirable IIR filter. A type of reference analog prototype filter to
be used is specified according to the s pecifications and after that everything is ready for analog p rototype filter desi gn.
The next step in the des ign process is s caling of the frequency range of analog prototype filter into desirable frequency range. This is how
an analog prototype filter is converted into an analog filter.
After the analog filter is designed, it is time to go through the last step in the dig ital IIR filter des ign process . It is conversion from ana log to
digital filter. The most popular and m ost comm only used converting method is bilinear transformation method. The resulting filter, obtained
in this way, is always stable. However, instability of the resulting filter, when bilinear transformation is used, may be caused only by the
finite word-length side-effect.
3.2.1 Basic concepts and IIR filter specification
First of all, it is neces say to learn the basic concepts that will be us ed further in this book. You should be aware that without being familiar
with these concepts, it is not poss ible to understand analyses and s ynthesis of digital filters.
Figure 3-2-1 illustrates a low-pass digital filter specification. The word specification refers to the frequency response specification.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
3/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 3
Figure 3-2-1a. Low-pass digital filter specification
Figure 3-2-1b. Low-pass digital filter specification
p normalized passband cut-off frequency;
s normalized stopband cut-off frequency;
1 maximum passband ripples;
2 minimum stopband attentuation;
passband attenuation parameter;
A stopband attenuation parameter;
ap maximum passband ripples [dB]; and
as minimum stopband attenuation [dB].
Frequency normalization can be expressed as follows:
where:
fs is the sampling frequency;
f is the frequency to normalize; and
is the normalized frequency.
Specifications for high-pass , band-pass and band-stop filters are defined almost the same way as those for low-pass filters. Figure 3-2-2
illustrates a high-pass filter specification, whereas Figure 3-2-3 illustrates a band-pass filter specification.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
4/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 4
Figure 3-2-2a. High-pass digital filter specification
Figure 3-2-2b. High-pass d igital filter sp ecification
Comparing these two Figures 3-2-1 and 3-2-2, it is obvious that low-pass and high-pas s filters have similar specifications. The sam e
parameters are defined in both cases with the difference that in the later case the pas sband is s ubstituded by the stopband and vice versa.
Figure 3-2-3 illustrates a band -pass specification.
Filter 3-2-3a. Band-pass digital filter specification
Figure 3-2-3b. Band-pass digital filter specification
Figure 3-2-4 illustrates band-s top digital filter specification
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
5/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 5
Figure 3-2-4a. Band-stop d igital filter s pecification
Figure 3-2-4b. Band-stop digital filter specification
3.2.2 Z-transform
The Z-transform is performed upon dis crete-time s ignals. It converts a discrete timedomain s ignal into a complex frequency-domin
representation. It is very suitable for analyzing dis crete time-domain s ignals and systems as well. The z-transform is derived from the
Fourier discrete time-domain transformation and is considered the bas ic operation in digital filter design process .
The Z-transform is defined as :
where z is the complex number.
Example:
Assum e that samples of a discrete-tim e signal x(n) are known. It is necess ary to transform this s ignal wi th the z-transform and Fourie r
fransform.
x(n)={1,2,3,4,5,4,3,2,1} ; 0 n 8
z-transform is defined via express ion:
It becomes :
The last expression is the z-transform of the given si gnal.
The Fourier transformation can be found by rewriting the previous expression in terms of z as z=e^j. It becomes:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
6/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 6
Figure 3-2-5 illustrates the (frequency) spectrum of the given signal.
Figure 3-2-5. Frequency spectrum of the given signal
Comparing Z and Fourier transforms, it is easy to notice som e sim ilarities between them:
In polar coordinates, the complex number z may be expressed as follows:
The two last expressions lead us to the conclusion that Fourier transform is just a s pecial form of the z-transform forr=1.
In the z plane, the Fourier transform is represented as a unit circle, which can be seen in Figure 3-2-6 below.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
7/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 7
Figure 3-2-6. Fourier transform in the z plane
The z-transform of the transfer function is of great importance for IIR filters. The location of poles in the z plane is used for testing stability of
designed IIR filter. The poles of the IIR filter transfer function mus t be located within the unit circle in o rder that filter is stable.
Figure 3-2-7a illustrates zeros and poles of the transfer function of a s table IIR filter in the z plane.
Figure 3-2-7a Stable IIR filter
Transfer function zeros are denoted by small circles , whereas its poles are denoted by sm all crosses.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
8/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 8
Re Real axis
Im Imaginary axis
As seen in Figure 3-2-7, one trans fer function zero is located outs ide the unit circle. It doesn t cause any problem as the location of poles is
the only thing that matters. All four poles of transfer function are located within the unit circle, which guarantees tha stability of IIR filters.
According to the location of poles i n the z plane, it is easy to determine whether it refers to FIR or IIR filter. The poles of the FIR filter transfer
function are located at the origin. It is obviously not the case in Figure 3-2-7, which means that it refers to IIR, not FIR filter.
Also, Figure 3-2-7a clearly indicates interrelation between zeros and poles in the z plane . If a zero or a pole is located on the real axe in the
z plane, i.e. the imagi nary part is zero, then it is single. If either of them is not located on the real axis i n the z plane, then it has the
corresponding pair having the sam e real value and the sam e imagina ry value with the opposite s ign. In the z plane, it is illustrated as a
pair of zeros or poles whi ch are symmetric around the real axis. Such a pair is also called a complex-conjugated pair of zeros or poles.
Figure 3-2-7b illustrates the zeros and poles of the transfer function of an instable IIR filter in the z plane.
Figure 3-2-7b. Instable IIR filter
As seen from Figure 3-2-7b, two poles loca ted outside the unit circle make this IIR filter ins table. If bilinear transformation is used in the
filter des ign, the resulting filter is s table before the coefficient quantization starts. This quantization changes the location of zeros and poles
of the resulting IIR filter, which can cause one pole o r one pair of poles to be located outside the unit circle. The result of such a
quantization is a filter that is not stable.
3.2.3 Transfer function of discrete-time systems
The Z-transform is primarily used for finding the transfer function of linear discrete-time s ystems. When the transfer function is found, it is
necess ary to cons ider the zeros and po les of the transfer function in the z plane. The transfer function of discrete-time s ystems is defined
to be:
where:
bi are the feedforward filter coefficients (non-recursive part);
aj are the feedback filter coefficients (recursive part);
H0 is a constant;
qi are the zeros of the transfer function;
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
9/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 9
pj are the poles of the transfer function;
B(z) is the transfer function of non-recursive part of the system; and
A(z) the transfer function of recursive part of the system (feedback).
The recursive part of the transfer function is actually a discrete-time system feedback. Unlike the FIR filters, the IIR filters have feedback
which enable them to have greater selectivity as well as nonlinearity of phase characteristic than FIR filters.
Figure 3-2-8. illustrates block diag ram of discrete-time system with feedback.
Figure 3-2-8 Discrete-time system with feedback
In the time dom ain, the discrete-time s ystem shown in Figure 3-2-8 can be expressed as follows:
OR
The later expression is more convenient for software IIR filters realization.
In the frequency domain, the discrete-time s ystem shown in Figure 3-2-8 can be expressed as the mu ltiplication of Z-transform input
signal X(z) and the transform function H(z):
The first way of representing discrete-time systems is s uitable for both software and hardware IIR filter implementation, whereas the
representation in the z domain is suitable for analyzes of des igned filters and synthesis itself (design proces s).
Example:
The transfer function of a 3th order IIR filter, designed us ing Chebyshev function is :
The following express ion describes the filtering process :
This process is als o known as convolution. Another express ion for convolusion that is m ore useful in practical applications is:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
10/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 10
After making s ubs titutions of impulse response coefficients , it becom es:
Using expression:
it is pos sible to find function for particular normalized frequency.
For example, when = 0.2:
The numerator is com puted first:
Then denominator:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
11/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 1
Figure 2-2-8 illus trates a hardware realization of this IIR filter.
Figure 3-2-9. Realization of IIR filter in th is examp le
The software realization would require two buffers each of minimum length 3. One buffer would be used for input samples and another
one for output sam ples. These are usually circular buffers whose length can be expressed as 2^n, which in this case m eans that the
circular buffer is 4 = 2^2 in length.
By complexity, the given IIR filter corresponds to a 6th order FIR filter. Selectivity and attenuation of this filter are much higher than those of
any 6th order FIR filter. The result of the feedback, which provides so high selectivity and attenuation, is a non-linear phas e characteristic.
3.2.4 Effects of the poles and zeros of the transfer function
The location of poles and zeros of the transfer function is very important for discrete-time system analyses and synthesis . According to their
location it is pos sible to test stability of a discrete-time s ystem, detect round-off errors made due to so ftware implem entation of a filter as
well as coefficient errors encountered during hardware implementation of a filter.
In order that a discrete-time s ystem is s table, all poles of the discrete-time system transfer function must be located within the unit circle,
as s hown in Figure 3-2-6. If this requirem ent is not satisfied, the system becom es uns table, which is very dangerous. The location of
zeroes doesnt affect the stabilty of discrete-time systems . Recalling that FIR flters do not have a feedback, which m akes them stable.
However, this doesnt apply on IIR filters. Therefore, it is preferable to use bilinear transformation becaus e it always m akes filter stable. In
this case, filter stability is ques tioned only due to coefficient quantization which is performed at the end of the des ign process.
It always happens due to software and hardware implem entation that an error in coefficients represen tation is produced. In software
implem entation, an error is triggered by the finite word-length effect, whereas in hardware implem entation, it ocurrs due to impossibility of
representing the coefficients w ith apsolute accuracy. The resu lt in both cases is that the actual value of coefficients differs from their value
obtained in design process . A direct result of such errors is deviation of the frequency of designed dis crete-time s ystem.
Deviation of frequency depends on the spacing between the zeros and poles of the FIR filter transfer function and the origin in the z plane.
The FIR filter coefficient error affects more the frequency respons e as the spacing between the zero and pole of the transfer function and
the origin narrows. This property is particularly typical of high-order filters because their zeros are very close each other. Besides , the pole
quantization, by rule, affects more frequency characteristic. Slight errors in coefficient representation m ay cause large frequency deviations.
Figure 3-2-9 illus trates the required and obtained frequency characteristic of an IIR filter. The finite word-length effect on the transform
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
12/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 12
function of an IIR filter is clearly marked in this figure.
Figure 3-2-10. Deviation from required frequency characteristic
The frequency deviation shown in Figure 3-2-10 is basically s light deviation, even though it is very large at certain frequencies. The
minimum attenuation and the width of transition region o f the resulting IIR filter remain unchanged, so that such deviation is acceptable.
3.2.5 IIR filters design using bil inear transformation
The IIR filter design us ing bilinear transformation can be s plit into several steps:
The final objective of defining IIR filter specifications is to find the des irable norm alized cutoff frequencies (c, c1, c2), transition width,
maximum pas sband attenuation and minim um s topband attenuation. The type of analog prototype filter as well as the filter order will be
specified according to these parameters.
Now, it is time to specify the type of reference analog prototype filter. Be aware that every type has its good and bad sides. It is only
important that its characteristics can satisfy the given specifications. However, it is preferable to s pecify such a type of analog prototype
filter that can produce the lowest order IIR filter.
After this step , that is, when the type of analog proptotype filter is known, it is necess ary to specify or compute the filter order required for a
given set of specifications. The initial value of the filter order is roughly estimated and is changed after that depending on the obtained
characteristics and requirements.
When both type and o rder of analog prototype filter are known, it is poss ible to find its transfer function.
The transfer function of analog prototype filter depends on frequencies which are not s caled into the des irable range. For this reas on, it is
necess ary to perform s caling of the transfer function so that cut-off frequencies go into the des irable range. This operation is actually
conversion of reference analog prototype filter into analog filter with des irable characteristic.
Finally, the transfer function of the specified type of reference analog prototype filter is obtained by converting analog filter into digital one.
This book represents the most commonly used conversion known as bilinear transformation.
If the resulting filter doesnt satisfy the given specifications, or if the filter order can be less than actual one, it should be changed. IIR filters
have much greater selectivity and attenuation than FIR filters o f the same order. For this reason, it is preferable to increase or decrease the
filter order by 1. After changing the filter order, the entire IIR filter design process, i.e. computing of the transfer function of reference analog
prototype filter, scaling and obtaining analogue filters and conversion into digital filter, is repeated.
3.2.6 IIR filter realization
FIR filter transfer function can be expressed as :
where:
N is the filter order;
bk the coefficient of non-recursive part of IIR filter; and
ak the coefficient of recursive part (feedback) of IIR filter.
The coefficients bk and ak are of interest for IIR filter realization (both hardware and software). Figure 3-2-11 illus trates the b lock diagram of
1. Defining filter specification;
2. Specifying analog prototype filter;
3. Computing the filter order required for a given set of specifications and speci fied analog prototype filter;
4. Computing the transfer function of reference analog prototype filter;
5. Conversion into analog filter via scaling;
6. Conversion into digital filter via bilinear transformation; and
7. If the obtained filter doesnt sat isfy the given specifications or if it is possible to decrease the filter order, then it is
necessary to do it. The filter order can be increased or decreased according to needs and after that steps 4, 5 and
6 are repeated as many times as needed.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
13/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 13
IIR filter.
Figure 3-2-11. Block diagram of IIR filter
There are several types of IIR filter realization. This chapter covers direct, direct transpos e, direct canonic, direct transpose canonic and
cascade realizations. All of them a re very convenient and mos t commonly us ed for both hardware and s oftware IIR filter realization. Each of
them will be described in detail along with their advantages and dis advantages.
3.2.6.1 Direct realization
Direct realization of IIR filters s tarts with this express ion:
The first part of the expression refers to non-recursive part and the other refers to recursive part of IIR filter. In IIR filter direct realization,
these two parts are s eparately considered and realized.
The realization of non-recursive part of IIR filter is identical to the direct realization of FIR filter. Figure 3-2-12. illustrates the block diagram of
direct realization of non-recursive part of IIR filter.
Figure 3-2-12. Direct re alization of non-recurs ive part of IIR filter
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
14/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 14
As seen from Figure 3-2-12 above, multiplication coefficients are identical to those of the trans fer function.
Realization of non-recursive part of IIR filter is similar to that of recursive part. Figure 3-2-13. illustrates the direct realization of the filter
recursive part.
Figure 3-2-13. Direct re alization of non-recurs ive part of IIR filter
As non-recurs ive and recurs ive part of IIR filter are separately realized, it doesn t matter which of them will be used firs t in filtering process.
Figures 3-2-14a and 3-2-14b illustrate block diagram s o f IIR filter realization when non-recursive part is used before and after recursive
part of IIR filter, respectively.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
15/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 15
Figure 3-2-14a. IIR filter direct realization, non-recursive part is used first
Figure 3-2-14b. IIR filter direct realization, recursive part is used first
This structure is als o known as a direct form I structure. As s een from Figures 3-2-14a and 3-2-14b, direct realization requires in total of 2N
delay lines, (2N+1) multiplications and 2N additions.
Direct realization is very convenient for software implementation and this is whe re it is m ost comm only used. Some of disadvantages of
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
16/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 16
this realization are the greatest sensitivity to accuracy of realized coefficients (i.e. the largest finite word-length effect), and the greatest
complexity due to implem entation (i.e. needs m ost resources ).
On IIR filter software implementation with direct structure, it is necess ary to have two buffers with at least N+1 s amples , where N is the IIR
filter order. For their simplicity and effectiveness, mos t commonly used are the so called circular buffers the length of which can be
expressed as 2^k. The value of constant k is defined as a minim um value for which N 2^k is valid. Accordingly:
where the operator represents rounding down to a less value.
Figure 3-2-15. Circular buffe r of length 16 = 2^4
Since the buffer length is 16, location addressing in the circular buffer is pe rformed via module 16 operations:
Example:
A 6th order FIR filter is used in this example. It is necessary to design this filter us ing direct structure with circular bu ffer. The length of the
buffer needs to be 2^k.
The length of circular buffer is obtained from the following express ion:
It means that the minimum length of circular buffer is 2^3 = 8.
The contents of the buffer after receiving the first 10 s amples is s hown in the table 3-2-1. Input samples are denoted by x[n] and each
shaded cell repres ents changed location in buffer.
STEPADDR.
7
ADDR.
6
ADDR.
5
ADDR.
4
ADDR.
3
ADDR.
2
ADDR.
1
ADDR.
0
0
1 x[0]
2 x[1] x[0]
3 x[2] x[1] x[0]
4 x[3] x[2] x[1] x[0]
5 x[4] x[3] x[2] x[1] x[0]
6 x[5] x[4] x[3] x[2] x[1] x[0]
7 x[6] x[5] x[4] x[3] x[2] x[1] x[0]
8 x[7] x[6] x[5] x[4] x[3] x[2] x[1] x[0]
9 x[7] x[6] x[5] x[4] x[3] x[2] x[1] x[8]
10 x[7] x[6] x[5] x[4] x[3] x[2] x[9] x[8]
Table 2-2-2. Input circular buffer after receiving 10 samples
3.2.6.2 Direct transpose re alization
Direct transpose realization is sim ilar to direct realization. The only difference is in the pos ition of delay lines, i.e. buffer if it is about
software implementation. Here, it is also necessary to have two buffers of minim um length N+1, where N is the filter order.
Figures 3-2-16 and 3-2-17 illus trate the block diagram describing IIR filter direct transpos e realization structure of IIR filter.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
17/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 17
Figure 3-2-16. IIR filter direct transpose realization, non-recursive part is used first
Figure 3-2-17. IIR filter direct transpose realization, recursive part is used first
There are no s ignificant differences be tween direct and direct transpose realizations. Both structures have the sam e multiplication
coefficients. The only difference is in the position of delay lines. Simila r to direct realization s tructure, the direct transpose realization
structure uses 2N delay lines, (2N+1) multiplications and 2N additions.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
18/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 18
3.2.6.3 Direct Canonical Realization
Direct canonical realization structure has reduced numbe r of delay lines to the minimum , that is, N delay lines. This way, one of the main
disadvantages of direct and direct transpos e realization structures is eliminated. Recursive and non-recurs ive parts of IIR filter are not
considered separately, which causes implem entation to be more com plex than for direct realization s tructure. A good thing is that the
coefficients are the s ame as for direct realization.
Figure 3-2-18 illustrates the block diagram des cribing direct canonic realization structure of IIR filter.
Figure 3-2-18. Direct canonic realization structur e block diagram
Similarities between direct canonic s tructure block diagram and direct realization s tructure shown in Figure 3-2-14b are obvious. The
difference between realization structures shown in Figures 3-2-14b and 3-2-18 is that non-recursive and recurs ive part for direct canonic
realization s tructure cannot be treated s eparately, although it is easy to differentiate between them.
Direct canonic structure uses N delay elements, (2N+1) m ultipilications and 2N additions. Sensitivity to the accuracy of coefficients is the
sam e as for all previously described s tructures, which is the main disadvantage of this realization structure.
3.2.6.4 Direct transpose canonical realization
Direct transpos e canonical realization structure has reduced number of delay lines to the minimum o f N delay lines as well as reduced
number of adders to N+1. Recursive and nonrecursi ve parts of IIR filter are not considered s eparately, which causes implem entation to be
more com plex than for direct realization structure, but similar to direct canonical s tructure. A good thing is that the coefficients are the sam e
as for direct realization.
Figure 3-2-19 illustrates the block diagram des cribing direct transpose canonical realization structure of IIR filter.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
19/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 19
Figure 3-2-19. Direct trans pose canonic realization structur e block diagram
Similarities between direct transpose canonical structure block diagram and direct transpose realization structure shown in Figure 3-2-16
are obvious. The difference between realization structures shown in Figures 3-2-16 and 3-2-19 is that non-recursive and recurs ive part for
direct transpose canonical realization structure cannot be treated separately, although it is easy to differentiate between them.
Direct transpose canonic structure uses N delay elements, (2N+1) m ultipilication elements and N+1 adders. Sens itivity to the accuracy of
coefficients is the same as for all previously described s tructures, which is the main dis advantage of this realization structure.
3.2.6.5 Cascade Realization
Cascade realization s tructure is the mos t difficult to obtain from the transfer function (comparing to other realization s tructures given in this
book). It is very convenient for its m odular s tructure and less sens itivity to the accuracy of non-recursive and recurs ive coefficients
realization. On cascade IIR filter realization, a filter is divided into several, mutually independent sections of the first or s econd order.
Individual sections are m ostly realized in di rect canonical or direct transpose canonical s tructure.
Since the sections are mutually independent after design process , the finite word-length effect on the accuracy of coefficients, m odulation
of frequency respons e and IIR filter stability are sepa rately examined for each section. The analyse is simp lified this way.
The IIR filter transfer function is expressed as :
where:
bi are the coefficients of transfer function numerator (non-recursive part);
aj are the coefficients of transfer function denominator (recursive part);
H0 is a constant;
qi are the zeros of the transfer function;
pj are the poles of the transfer function;
B(z) is the transfer function of non-recursive part;
A(z) is the transfer function of recursive part (feedback); and
M is the number of sections in cascade realization structure.
Cascade realization requires the given expression to be factorized so that the transfer function is expressed as follows:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
20/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 20
where:
a[i, k] are the coefficients of recursive part of the i-th IIR filter section;
b[i, k] are the coefficients of non-recursive part of the i-th IIR filter section.
Individual sections are of the first or s econd order. Direct transpose canonical s tructure is mos t frequently used in realization. Figure 3-2-
20 illus trates a first-order section.
Figure 3-2-20. First-order section
Figure 3-2-21 illustrates a second-order section.
Figure 3-2-21. Second-order section
The use of direct transpose realization structure reduces necess ary number of delay lines and adders as well . Filter dividing in
independent sections reduces the sens itivity to the accuracy of quantization coefficients and simp lifies analysing the stability of the
resulting filter. Besides, the poss ibility that IIR filter becomes instable after quantization is drastically reduced as the coefficients
quantization is performed after dividing filter in sections, so the changes of poles locations are sm aller, therefore.
Software realization requires M buffer of length 2 or 1 . Each section mus t have its own buffer for saving sam ples of intermediate signals .
Such complexity and needed factorization are two m ain dis advantages of this realization structure.
Figure 3-2-21 illustrates the block diagram des cribing cascade IIR filter structure.
Figure 3-2-22. Cascade IIR filter structur e
3.3 Reference Analog Prototype Filter
IIR filter design process starts with reference analog prototype filter. This book explains Butterworth, Chebyshev (Chebyshev I) and inverse
Chebyshev filter (Chebyshev II).
The transform function of analog filter Hsa(s) is expressed as:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
21/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 2
where:
N is the filter order;
s is the complex frequency (s = + j); and
M N.
In order that a system described via expression above is stable, it is necessary that all poles (the square roots of polinomial Aa(s)) are
located in the left half of S plane. Figure 3-3-1 illustrates S plane.
Figure 3-3-1. S plane and re gion of stability
A low-pass filter is used for analog filter des ign. The conversion into the appropriate type of filter (high-pas s, band-pass or band-s top) is
performed by converting into analog filter, i.e. frequency axis scaling.
3.3.1 Butterworth analog filter
Low-pass Butterworth analog filters are filters whose frequency response is a monotonious descending function. They are also known as
maximally flat magnitude filters at the frequency of = 0, as the first 2N - 1 derivatives of the transfer function when = 0 are equal to
zero.
Butterworth filter is characterized by 3dB attenuation at the frequency of =1, no matter the filter order is. Figure 3-3-2 illustrates frequency
respons es for a few various parameters N (filter order).
Figure 3-3-2. Frequency response of Butterworth filter
Butterworth filter is defined via expression:
where:
is the frequency; and
N is the filter order.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
22/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 22
Figure 3-3-3. IIR filter s pecification
Figure 3-3-3 illus trates IIR filter specification with parame ters of m ost interest for Butterworth filter.
To design Butterworth reference analog prototype filter, it is necessary to know the filter order. All poles of the resulting filter mus t be
located in the left half of the S plane, i.e. to the left of the imaginary axis.
Note:
In the z plane, filter is stable if all poles are located within the unit circle. In the s plane, filter is stable if all poles are located in the left half of
the s plane. Z-transform is used for digital filters, whereas Laplase transform (s plane) is used for analog filters. Even though these two types
of transformations are similar to some extent, they should not b e mixed up concerning the filter stability analyse.
When the filter order is known , it is easy to find its poles using express ion:
Butterworth poles are equally allocated (equidistantly) on the unit circle within the left half of the s plane. The location of poles for N=5 and
N=6 is shown in Figure 3-3-4.
Figure 3-3-4. Position of Butterw orth filter poles fo r N=5 and N=6
The transfer function of the Butterworth reference analog prototype filter is expressed as follows:
where:
Sk is the k-th pole of the Butterworth filter transfer function
For N=5, the transfer function is:
3.3.2 Chebyshev Analog Filter
Chebyshev analog low-pass filter of the first kind is a type of analog filter that has the least oscillation in frequency respons e in the entire
pass band. Therefore it is characterized by equal ripple in the passband and the stopband frequency respons e is m onotoniously
descending function.
Figure 3-3-5 illustrates frequency response for a 4th order band-s top Chebyshev reference analog filter.
Figure 3-3-5. Frequency response of Chebyshev analog filter
To design Chebyshev reference analog prototype filter, it is necessary to know the filter order.
Chebyshev analog filter is defined via expression:
where:
is the frequency;
N is the filter order;
is a parameter used to define maximum os cillations in the pass band frequency respons e; and
TN is the Chebyshev polynomial.
The Chebyshev polynomial TN() can be obtained via recursive relations:
If the filter order is known in advance, neither recursive relations nor express ion for the square of frequency respons e are neces sary. The
design process starts from the values of poles of a 1s t order Chebyshev reference analog filter.
The values of poles are expressed as :
where:
si is the i-th transfer function pole of analog prototype filter (complex value);
i is the pole; and
i is the imaginary pole.
where:
N is the filter order; and
i=1, 2, ..., N.
The value of parameter is obtained via expression:
Transfer function is expressed as :
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
23/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 23
The value of A0 is found via express ion:
For N=5, the transfer function is:
Figure 3-3-6. Location of the poles o f Chebyshev filter for N=5
3.3.3 Inverse Chebyshev Analog Filter
Inverse Chebyshev analog filter is also known as Chebyshev analog filter of the second kind. The frequency response o f this filter
monotoniously falls i n the passband and transition region. Similar to Butterworth filter, the frequency response is extremely flat function at
the frequency of = 0, as the first 2N - 1 derivatives of the transfer function for = 0 are equal to zero. In the stopband, inverse Chebyshev
filter has the least oscillation in the frequency response.
Figure 3-3-7 illustrates the frequency response for an inverse Chebyshev reference analog band-stop filter of the 4th order.
Figure 3-3-7. Freque ncy characteristic of inver se Che byshev analog filter
To design inverse Chebyshev reference analog pototype filter, it is necessary to know the filter order.
Inverse Chebyshev analog filter is defined via expression:
where: is the frequency;
N is the filter order;
is the parameter of maximum os cillation in the passband frequency response; and
TN is the Chebyshev polynomial.
The Chebyshev polynomial TN() can be obtained from recurs ive relation:
If the filter order is familiar in advance, neither these recursive relations nor expression for the square of frequency response are
necess ary. The design process s tarts from the values of poles of a 1st order inverse Chebyshev reference analog filter.
The poles of the transfer function of inverse Chebyshev analog filter are considered reciprocal poles of the transfer function of a 1s t order
Chebyshev analog filter.
The poles of a 1s t order Chebyshev analog filter are expressed as :
where:
si is the i-th pole of the transfer function of analog prototype filter (complex value);
i is the real pole; and
i is the imaginary pole.
where:
N is the filter order; and
i=1, 2, ..., N.
The poles of the transfer function of inverse Chebyshev analog filter are found via expression:
where:
si i s the pole of the transfer function of a 1s t order Chebyshev analog filter; and
s2i is the po le of the transfer function of inverse Chebyshev analog filter.
Transfer function is expressed as :
The coefficient k in numerator can be only an odd number. Table 3-3-1 provides a few examples of values ofk.
N M I N M A X V A L UES
5 1 5 1, 3, 5
6 1 5 1, 3, 5
7 1 7 1, 3, 5, 7
8 1 7 1, 3, 5, 7
Table 3-3-1. coefficient k in the transfer function numerator
The values k are found via express ion:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
24/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 24
The value H0 is found via express ion:
For N=5, the transfer function is:
Figure 3-3-8. Location of poles and zeros of inverse Chebyshev filter for N=5
As seen from Figure 3-3-8 and express ion for k, the zeros of the transfer function are always com plex-conjugated values, which is not the
case wi th the poles o f the transfer function.
3.4 Analog prototype filter to analog filter transformation
All analog prototype filters, regardless of their type, have scaled frequency range so that the passband cut-off frequency amounts to = 1.
For this reason, it is neces sary to scale filter during the design process, so that passband and stopband cut-off frequencies have the
appropriate, predetermined values.
Reference analog prototype filter is als o a low-pas s filter so it requires to be transformed into the appropriate type of filter, i.e. high-pass ,
band-pass or band-stop filter, if needed.
Transformation from an analog prototype filter to appropriate analog filter is performed before transforming it in digital filter.
Frequency scaling depends on the type of analog filter being desi gned. Scaling is explained for low-pass , high-pass, band-pass and
band-stop filters.
All the results ob tained in this chapter are tes ted in the Filter designer tool program.
3.4.1 Low-pass filter
The transformation from a reference analog prototype filter to a low-pass analog filter is the simp lest type of transformation. Analog
prototype filter is a low-pass filter with the cut-off frequency of p=1. In this case, the transformation comes to a sim ple frequency scaling.
In the transform function, s\\c is used instead ofs, where c is a desirable cut-off frequency in the passband.
Generally, the transform function of the reference analog prototype filter can be expressed as follows:
where
H0 is a cos tant;
zk is the k-th zero of the transfer function of the reference analog prototype filter;
M is a number of zeros of the transfer function of the reference analog prototype filter;
pk is the k-th pole of the transfer function of the reference analog prototype filter; and
N is a number of poles of the transfer function of the reference analog prototype filter and the filter order as wel l.
By performing the transformation:
each expression within brackets in the transfer function numerator is transformed into:
and the whole numerator is transformed into:
Each bracket in denominator is transformed s imilarly:
and the entire denominator is transformed into:
By replacing numerator and denom inator by their transformed express ions, the transform function of the analog filter is obtained:
Example:
The transform function of the Butterworth reference analog prototype filter of the 3rd order is expressed as follows:
The transformation in a band-pass analog filter with the cut-off frequency c = 0.2929 in the passband is obtained via express ion:
Example:
The transform function of inverse Chebyshev reference analog prototype filter of the 3rd order is expressed as follows:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
25/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 25
The transformation to a band-pass analog filter with the cut-off frequency c=0.3719 in the pass band is ob tained via expression:
3.4.2 High-pass filter
Analog prototype filter is a low-pas s filter with the cut-off frequency p = 1. Its transformation to a high-pass ana log filter can be split into
two steps. The first step refers to the transformation to a high-pas s analog filter, whereas the second one refers to frequency scaling. The
final objective is that passband cut-off frequency of the resulting high-pass analog filter amounts to c.
The transformation to a high-pas s ana log filter:
Scaling of frequency axis is performed by transformation:
These two transformations can be represented by one transformation:
Generally, the transform function of the reference analog prototype filter can be expressed as follows:
where:
H0 is a constant;
zk is the k-th zero of the transfer function of the reference analog prototype filter;
M is a number of zeros of the transfer function of the reference analog prototype filter;
pk is the k-th pole of the transfer function of the reference analog prototype filter; and
N is a number of poles of the transfer function of the reference analog prototype filter and the filter order as wel l.
By performing the following transformation:
each bracket in the numerator of the transfer function is transformed into
and the entire numerator is transformed into:
Each bracket in denominator is transformed s imilarly:
and the entire denominator is transformed into:
Substituting these transformed expressions for numerator and denom inator, the transform function of the analog filter is obtained:
Example:
The transfer function of the Chebyshev reference analog prototype filter of the 3rd order is expressed as follows:
The transformation in a band-pas s analog filter with the cut-off frequency c = 0.3721 in the passband is expressed as:
The result is the transfer function of analog filter:
Example:
The transfer function of inverse Chebyshev reference analog prototype filter of the 2nd order is expressed as follows:
The transformation in a band-pass analog filter with the cut-off frequency c=0.1434 in the passband is expressed as:
The result is the transform function of analog filter:
3.4.3 Band-pass filter
The transformation in a band-pass analog filter is m ore complex than the transformation in a low-pass and high-pass analog filters. The
filter order is doubled by this transformation. This is why it is not poss ible to design an odd o rder band-pass filter.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
26/45
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
27/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 27
The result is the transfer function of analog filter:
3.4.4 Band-stop filter
The transformation in a band-stop analog filter is s imilar to the transformation in a bandpas s ana log filter. Similarly, the filter order is
doubled and the order of a band-s top digital filter cannot be an odd number.
When designing, the required filter order is divided by two. The resulting filter order is used for des igning a low-pas s reference analog
prototype filter. The transformation into a bandstop analog filter causes the filter order to double. This is how the required filter order is
obtained.
Example:
It is necessary to des ign a band-s top digital filter of the 10th order.
A low-pass reference ana log filter of the 5th order is des igned firs t.
The reference analog filter is trans formed in a band-s top analog filter. This transformation causes the filter order to double. The result is a
10th order filter.
The transformation in a band-s top analog filter:
The value of the constant 0 can be found via express ion:
where:
s1 is a lower cut-off frequency in the stopband (refer to figure 3-4-2); and
s2 is a higher cut-off frequency in the stopband (refer to figure 3-4-2).
Figure 3-4-2. Band-stop filter specification
The value of c, which is neces sary for normalization, is found via expression:
The transfer function of the reference analog prototype filter is transformed first into a band-stop analog filter, and normalized after that with
c.
Generally, the transfer function of the reference analog prototype filter can be expressed as follows:
where:H0 is a cons tant;
zk is the k-th zero of the transfer function of the reference analog prototype filter;
M is a number of zeros of the transfer function of the reference analog prototype filter;
pk is the k-th pole of the transfer function of the reference analog prototype filter; and
N is a number of poles of the transfer function of the reference analog prototype filter and the filter order as wel l.
The first step refers to normalization with the frequency c:
The transformation is performed in the second step:
and each bracket in the transfer function numerator is transformed in:
and the entire numerator is transformed in:
Each bracket in denominator is transformed s imilarly:
and the entire denominator is transformed in:
Substituting the transformed express ions for numerator and denom inator, the transform function of analog filter is obtained:
Example:
The transfer function of inverse Chebyshev reference analog prototype filter of the 2nd order is expressed as :
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
28/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 28
The transformation into a band-stop analog filter with the cut-off frequency c=0.252.5727 in the pas sband is express ed as :
The result is the transfer function of analog filter:
3.5 Bilinear transformation
Digital IIR filters are des igned us ing analog filters. After the frequency scaling and transformation into a des irable type of filter have been
performed, it is neces sary to transform the resulting analog filter into a digi tal one. It is done by transforming the analog filter transfer
function into a di gital one.
The transformation is supposed to:
This transformation also transforms s plane into z plane.
Analog filter is stab le if the poles o f the transfer function are located in the left half of s plane, whereas digital filter is s table if the poles are
located within the unit circle. For this reason, the transformation mus t provide that the left half of s plane coincides with the area within the
unit circle of z plane, as s hown in Figure 3-5-1.
Figure 3-5-1. Transformation of s p lane into z plane
One of most comm only used method of transforming analog filters into appropriate IIR filters is known as bilinear transformation. It is
defined via express ion:
Using the previous express ion, the transformation of the analog filter transform function into a digital one can be expressed as:
As seen, the transformation is performed by a simpl e change of variable s in the express ion for the transfer function of the resul ting analog
filter.
The analog filter transfer function can be express ed as:
where:
H0 is a constant. If s=0 then H(s)=H0 ;
zk is the zero of the analog filter transfer function; and
pk is the pole of the analog filter transfer function.
After transformation, the analog filter trans fer function is further transformed in to:
where:
Hoz is a constant of the digital IIR filter transfer function
Example:
The transfer function of a s econd-order high-pass analog filter (inverse Chebyshev, fc=2KHz, fs=44100Hz, 60dB) is expressed as :
It is neces sary to transform the given analog filter into the appropriate digital filter by bilinear transformation.
Using express ion for linear transformation:
we obtain:
where:
N=2
M=2
z1=j0.1014
z2=-j0.1014
p1=-2.267+j2.2692
p2=-2.267-j2.2692
1. faithfully approximate the frequency response of analog filter; and
2. provide that the resulting digital filter is guaranteed to be stable.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
29/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 29
The result is the transfer function of a digital high-pass IIR filter. Realization structure is illus trated in Figure 3-5-2 below.
Figure 3-5-2. IIR filter realization
Digital filters designed via bilinear trasnformation are guaranteed to be s table. However, the accurate values of coefficients are obtained
immedi ately after the implementation of bilinear transformation. On filter realization, it is imposs ible to represent coefficients without an
error. In software digital filter realization (implem entation), the resulting coefficients are quantized, which also generates a certain error. Any
error made during the quantization of coefficients affects more or less the frequency respons e, which may further cause the s topband
attenuation to decrease.
The quantization effect on digital filter stability is much m ore dangerous . Special care is required when quantizing feedback coefficients asit causes the location of the digital IIR filter transfer function poles to change their location. It is very important to prevent the poles from
being located outside the unite circle. However, if it happens, the resulting IIR filter is not stable and is useles s therefore.
A disadvantage of the bilinear transform ation is a non-linear transform ation of the analog filter frequency axis into a digi tal one. When
designing, the cut-off frequencies are defined on the bas is of the given specifications and type of a filter. When transforming, these
frequencies have appropriate locations, which is not the case with the res t of the frequency axis. Such a non-linear transformation of
analog filter frequencies caus es the phase characteristic distorsion, so that it is not linear.
3.6 Examples
This chapter discusses various IIR filter design methods . The four standard types of filters are us ed here:
low-pass filter;
high-pass filter;
band-pass filter; and
band-stop filter.The design method used here is known as bilinear transformation.
The IIR filter design process can be split into several steps des cribed in Chapter 3.2.5 Designing IIR filters by b ilinear transformation.
These are:
Some s teps are skipped in some cas es. If the filter order is known, step 3 is skipped. If the type of reference analog prototype filter is
predetermined, step 2 is skipped.
In every given example, the IIR filter design process will be des cribed through these steps in order to make it eas ier for you to observe
sim ilarities and differencies between various des ign methodes , analog prototype filters and desi gn of various types of filters as well.
Figure 3-6-1 illustrates the design steps along with input and output data for each of them.
Figure 3-6-1. Steps in de signing digital IIR filter
The first block refers to design of reference analog prototype filter of appropriate order. The output data is a reference analog prototype filter
transfer function Ha(s). Regardles s of the type of reference analog prototype filter in use, the transfer function is given by:
where:
H0 is a cons tant;
zk is the k-th zero of the reference analog prototype filter transfer function;
M is a number of zeros of the reference analog prototype filter transfer function;
pk is the k-th pole of the reference analog prototype filter transfer function; and
N is a number of poles of the reference analog prototype filter transfer function and filter order as well.
Reference analog prototype filter is always a low-pass filter. The next step is the transformation into an analog filter of appropriate type. The
expression us ed to transform the reference analog p rototype filter transfer function depends on the type of filter that needs to be obtained.
The final result is the transfer function H(s) given by:
where:
H0 is a cons tant;
zk is the k-th zero of the reference analog prototype filter transfer function;
1. Defining filter specifications;
2. Specifying the type of analog prototype filter;
3. Computing the filter order according to the filter specifications and specified analog prototype filter;
4. Computing the transfer function of reference analog prototype filter;
5. Transformation into analog filter by range scaling;
6. Transformation into digital filter by bilinear transformation; and
7. If the resulting filter doesnt satis fy the given specifications or if it is possible to decrease the filter order, then it is
necessary to do it. The specified filter order is increased or decreased according to needs, and steps 4, 5 and 6
are repeated after that as many times as needed.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
30/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 30
M is a number of zeros of the reference analog prototype filter transfer function;
pk is the k-th pole of the reference analog prototype filter transfer function; and
N is a number of poles of the reference analog prototype filter transfer function and filter order as well.
As seen, the transfer functions of reference analog pro totype filter and analog filter are very simila r. They differ only in the value of constant
H0, the values of the transfer function poles and zeros zk and pk as well as in the numbe r of transfer function zeros M. The filter order is the
sam e if the analog filter is a low-pass or high-pass filter, whereas it is different if the analog filter is a band-pass or band-stop filter. In the
later case, the analog filter order (N) is twice that of the reference analog prototype filter.
The next step is the transformation into appropriate digital IIR filter using bilinear transformation given by expression:
Filter Designer Tool is used for testing and analysing the res ulting IIR filters in this chapter. All data are calculated with the accuracy of 4
decimal digits, which is s ufficient for mos t examples .
3.6.1 Filter design using Butterworth filter
3.6.1.1 Example 1
Step 1:
Type of filter low-pass filter
Filter specifications:
Filter order N=2;
Sampling frequency fs=20KHz;
Passband cut-off frequency fc=2.5KHz; and
Minimum stopband attenuation ap=40dB.
Step 2:
Method- filter design using Butterworth reference analog prototype filter.
Step 3:
Filter order is predetermined, N=2.
Step 4:
The Butterworth reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 2, the values of poles a re:
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Butterworth reference prototype filter has no zeros, the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
This general expression can be w ritten in a sim pler way in this example:
A more condens ed form of the previous expression is :
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
31/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 3
The result is the IIR filter transfer function.
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-2 illustrates the direct realization of designed IIR filter, whereas Figure 3-6-3 illustrates the frequency response of the filter
obtained using Filter Designer Tool.
Figure 3-6-2. Digital IIR filter dir ect re alization in this e xample
Figure 3-6-3. Digital IIR filter fr eque ncy characteris tic in this e xample
3.6.1.2 Example 2
Step 1:
Type of filter high-pass filter
Filter specifications:
Filter order N=3;
Sampling frequency fs=20KHz;
Passband cut-off frequency fc=5KHz; and
Minimum stopband attenuation ap=40dB.
Step 2:
Method- filter design using Butterworth reference analog prototype filter
Step 3:
Filter order is predetermined, N = 3.
Step 4:
The Butterworth reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 3, the values of poles a re:
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Butterworth reference prototype filter has no zeros, the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
This general expression can be w ritten in a sim pler way in this example:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
32/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 32
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-4 illus trates the direct realization of des igned IIR filter.
Figure 3-6-4. Digital IIR filter dir ect re alization in this e xample
Figure 3-6-5. Digital IIR filter fr eque ncy characteris tic in this e xample
3.6.1.3 Example 3
Step 1:
Type of filter band-pass filter
Filter specifications:
Filter order N=4;
Sampling frequency fs=20KHz; andPassband cut-off frequency fc1=4KHz, fc2=6KHz.
Step 2:
Method - filter des ign us ing Butterworth reference analog prototype filter
Step 3:
Filter order is predetermined, N = 4.
Step 4:
The Butterworth reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
When designing an IIR band-pass filter, the reference prototype filter order is half that of the required IIR filter order. In this example for N=4,
the order of reference prototype filter is 2, so the values of poles are:
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Butterworth reference prototype filter has no zeros, the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, by subs tituting the complex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
33/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 33
In this example, the general express ion can be written in a s impler way:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-6 illus trates the direct realization of des igned IIR filter.
Figure 3-6-6. Digital IIR filter dir ect re alization in this e xample
Figure 3-6-7. Digital IIR filter fr eque ncy characteris tic in this e xample
3.6.1.4 Example 4
Step 1:
Type of filter band-stop filter
Filter specifications:
Filter order N=4;
Sampling frequency fs=20KHz; and
Passband cut-off frequency fc1=3000Hz, fc2=3300Hz.
Step 2:
Method - filter design using Butterworth reference analog prototype filter.
Step 3:
Filter order is predetermined, N = 4.
Step 4:
The Butterworth reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
When designing an IIR band-stop filter, the reference prototype filter order is half that of the required IIR filter order. In this example for N =
4, the order of reference prototype filter is 2, so the values of poles are:
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Butterworth reference prototype filter has no zeros, the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, by subs tituting the complex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
34/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 34
In this example, the general express ion can be written in a s impler way:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-8 illus trates the direct realization of des igned IIR filter.
Figure 3-6-8. Digital IIR filter dir ect re alization in this e xample
Figure 3-6-9. Digital IIR filter fr eque ncy characteris tic in this e xample
3.6.2 Filter design using Chebyshev filter
3.6.2.1 Example 1
Step 1:
Type of filter low-pass filterFilter specifications:
Sampling frequency fs=44100Hz;
Passband cut-off frequency fc1=15KHz;
Stopband cut-off frequency fc2=18KHz;
Maximum passband attenuation ap=1dB; and
Minimum stopband attenuation as=40dB.
Step 2:
Method - filter design using Chebyshev reference analog prototype filter
Step 3:
Filter order is not pre-determined, so it is neces sary to choose an initial solution from which iterative method s tarts. The solution is
redefined progressively until som e pre-determined requirements are s atisfied. Lets as sum e that the initial filter order is 4.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 4, the values of poles a re:
The Chebyshev filter transfer function is expressed as:
In this case, the value of cons tant A0 is :
A0 = 0.2457
so that the Chebyshev reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Chebyshev reference prototype filter has no zeros , the express ion for transfer function is simpler:
Step 6:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
35/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 35
The transformation into a digital filter through bilinear transformation:
Generally, by subs tituting the complex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
This general expression can be w ritten in a sim pler way in this example:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
By analyzing the resulting filter using Filter Designer Tool, it is obvious that the attenuation am ounting to 31.2dB approximately at the
frequency of 18KHZ is not sufficient. The frequency characteristic of the resulting digital filter is illustrated in Figure 3-6-10 below.
Figure 3-6-10. Freque ncy characteris tic of the r esulting IIR filter
It is necess ary to additionally redefine the filter order until the predefined requiremen ts are s atisfied. The filter order is incremented by 1
and is 5 therefore. All s teps s tarting with s tep 3 are iterated.
Step3:
The filter order is incremented in the s econd iteration. A new filter order is 5.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 5, the values of poles a re:
The Chebyhsev filter transfer function is expressed as:
In this case, the value of cons tant A0 is :
A0 = - 0.1228
so the Chebyshev reference analog prototype filter transfer function is:
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Chebyshev reference prototype filter has no zeros , the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
36/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 36
This general expression can be w ritten in a sim pler way in this example:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
By analyzing the resulting filter using Filter Designer Tool, it is obvious that the attenuation amounting to 41.6dB approximately at the
frequency of 18KHZ is not sufficient. The frequency characteristic of the resulting digital filter is illustrated in Figure 3-6-11 below.
Figure 3-6-11. Freque ncy characteris tic of the r esulting IIR filter
It is not necessa ry to further increase the filter order as this one is appropriate. Sometimes more iterations are needed to determine the
filter order. The whole procedure is the s ame, only it takes m ore time.
Filter realization:
Figure 3-6-12 illus trates the direct realization of des igned IIR filter, whereas Figure 3-6-13 illustrates the frequency characteristic of the filter
obtained using Filter Designer Tool.
Figure 3-6-12. Digital IIR filter dire ct re alization
Figure 3-6-13. Frequency characteristic of digital IIR filter
3.6.1.2 Example 2
Step 1:
Type of filter high-pass filter
Filter specifications:
Filter order N = 3;
Sampling frequency fs = 20KHz;
Passband cut-off frequency fc = 5KHz; and
Maximum passband attenuation ap = 1dB.
Step 2:
Method - filter design using Chebyshev reference analog prototype filter
Step 3:
Filter order is predetermined, N = 3.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 3, the values of poles a re:
The Chebyshev filter transfer function is expressed as:
In this case, the value of cons tant A0 is :
A0 = - 0.4913
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Chebyshev reference prototype filter has no zeros , the express ion for transfer function is simpler:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
37/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 37
After subs titution of poles and c into express ion:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
This general expression can be w ritten in a sim pler way in this example:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-14 illus trates the direct realization of des igned IIR filter.
Figure 3-6-14. Direct r ealization of digital IIR filter in this example
Figure 3-6-15. Freque ncy characteris tic of digital IIR filter in this example
3.6.1.3 Example 3
Step 1:
Type of filter band-pass filter
Filter specifications:
Filter order N = 4;
Sampling frequency fs = 20KHz;
Passband cut-off frequencies fc1 = 4KHz, fc2 = 6KHz; and
Maximum passband attenuation ap = 1dB.
Step 2:
Method filter design using Chebyshev reference analog p rototype filter.
Step 3:
Filter order is predetermined, N = 4.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
When designing an IIR band-pass filter, the reference prototype filter order is half that of the required IIR filter order. In this example for N =
4, the order of reference prototype filter is 2, so the values of poles are:
The Chebyshev filter transfer function is expressed as:
In this example, the value of constant A0 is:
A0 = 0.9826
The reference analog prototype filter transfer function is :
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
38/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 38
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Chebyshev reference prototype filter has no zeros , the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
In this expression, the general expression can be written in a sim pler way:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 3-6-16 illus trates direct realization of des igned IIR filter.
Filter 3-6-16. Direct r ealization of digital IIR filter in this example
Figure 3-6-17. Freque ncy characteris tic of digital IIR filter in this example
3.6.1.4 Example 4
Step 1:
Type of filter band-stop filter
Filter specifications:
Filter order N = 4;
Sampling frequency fs = 20KHz;
Passband cut-off frequencies fc1 = 3000Hz, fc2 = 3300Hz; and
Maximum passband attenuation ap = 1dB.
Step 2:
Method - filter design using Chebyshev reference analog prototype filter.
Step 3:
Filter order is predetermined, N = 4.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
When designing an IIR band-pass filter, the reference prototype filter order is half that of the required IIR filter order. In this example for N =
4, the order of reference prototype filter is 2, so the values of poles are:
The Chebyshev filter transfer function is expressed as:
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
39/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 39
In this example, the value of constant A0 is:
A0 = 0.9826
The reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog filter transfer function is obtained from the reference analog prototype filter transfer function using expression:
As the Chebyshev reference prototype filter has no zeros , the express ion for transfer function is simpler:
Step 6:
The transformation into a digital filter through bilinear transformation:
Generally, subs tituting the com plex variable s into the expression for analog filter transfer function, the following is obtained:
where:
zk are the zeros of analog filter transfer function; and
pk are the poles of analog filter transfer function.
In this expression, the general expression can be written in a sim pler way:
A more condens ed form of the previous expression is :
The result is the IIR filter transfer function.
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization
Figure 3-6-18 illus trates the direct realization of des igned IIR filter.
Figure 3-6-18. Direct r ealization of digital IIR filter in this example
Figure 3-6-19. Freque ncy characteris tic of digital IIR filter in this example
3.6.3 Filter design using inverse Chebyshev filter
3.6.3.1 Example 1
Step 1:
Type of filter low-pass filter
Filter specifications:
Sampling frequency fs = 44100Hz;
Passband cut-off frequency fc1 = 15KHz;
Stopband cut-off frequency fc2 = 18KHz;
Maximum passband attenuation ap = 1dB; and
Minimum stopband attenuation as = 40dB.
Step 2:
Method - filter design using inverse Chebyshev reference analog prototype filter.
Step 3:
Filter order is not pre-determined, so it is neces sary to choose an initial solution from which iterative method s tarts. The solution is
-
7/27/2019 Chapter 3_ IIR Filters - Digital Filter Design
40/45
9/22/13 Chapter 3: IIR filters - Digital Filter Design - mikroElektronika
www.mikroe.com/chapters/view/73/chapter-3-iir-filters/ 40
redefined progressively until som e pre-determined requirements are s atisfied. Lets as sum e that the initial filter order is 4.
Step 4:
The Chebyshev reference prototype filter transfer function has no zeros, only poles. These can be com puted via expression:
As N = 4, the values of poles a re:
The inverse Chebyhsev filter transfer function is expressed as :
In this example, the value of constant H0 is:
H0 = 0.01
so that the Chebyshev reference analog prototype filter transfer function is :
Step 5:
First it is necessary to compute the analog prototype filter cut-off frequency c.
The analog