P27 Teaching Digital Filters Design in Electrical Engineering

advertisement
Teaching Digital Filters Design
in Electrical Engineering
B. Palczynska 1, K. M. Noga 2
Department of Marine Telecomunications 1, Department of Ship Automation 2
Gdynia Maritime University
Gdynia 81-225, Poland
Abstract- This paper presents programming tools used in a
project course of digital filters design. It discusses the
advantages of commonly used software packages which assist
designing infinite impulse response (IIR) filters and finite
impulse response (FIR) filters. Several examples of students
projects are presented. The properties of the applied
software environments, such as: MONARCH Series DSP
software, QEDesign Lite Software, MATLAB, CommSim 7
and Multisim 2001 are compared as tools useful in a didactic
process.
I.
INTRODUCTION
Digital signal processing (DSP) is an important
component of some courses in electrical engineering [1].
The significant role in DSP is played by: the theory, the
design and the analysis of digital filters. Nowadays, a
variety of software tools are available to design digital
filters.
In the Faculty of Marine Electrical Engineering a digital
filter design course is realised in the form of lectures and
projects. Their didactic aim is to introduce basic issues
and methods connected with infinite impulse response
(IIR) filters design and finite impulse response (FIR)
filters design. The individual work under the project helps
students understand design methodologies. The tasks
assigned by a teacher consist in designing a digital filter of
some definite parameters. Students have to do it with the
use of software tools they have chosen themselves, among
others: MONARCH Series DSP software (Athena Group
Inc.), QEDesign Lite Software (Momentum Data Systems
Inc., Compliments of Analog Devices), MATLAB
software environment (The MathWorks Inc.), CommSim7
or Multisim 2001 (Interactive Image Technologies Ltd.).
The Internal local area network connected to the Internet
gives students the access to: tutorials, tasks, problems,
examples and other didactic materials (presented on the
websites: http://www.am.gdynia.pl/we/ktm/dydaktyka and
http://www.am.gdynia.pl/~jagat).
This paper presents the discussion of the advantages of
software tools used in a project course of digital filters
design. These tools should not only help students solve
their design problem, but understand the subject matter
better. The use of ready-made software packages (MONARCH, QEDesign), can be treated additionally as the
introduction to a process of creating DSP applications.
The result data of both these programs, to which belong:
filter coefficients as well as a source code of the program
realising the designed filter, are generated in the format
understood and performed by digital signal processors of
the family ADSP-21XX by Analog Devices on the
Assembler level. In MATLAB software environment there
is a possibility of both making use of the dedicated tool Filter Design&Analysis Tool (FDATool) and creating a
programming script which performs the assigned
functions. The integrated with MATLAB interactive package SIMULINK allows modelling and analysing the
designed digital filter. CommSim 7 and Multisim 2001 are
popular education software, a complete system design tool
that offers an easy to use graphical interface for designing
and the analysis of FIR and IIR filters. In Commsim
environment the designing process and the filter analysis
are supported by the following blocks: FIR & Sampled
FIR, IIR, Adaptive Equalizer, MagPhase.
In the remainder of this paper several other examples of
students projects are presented. Special emphasis is laid
on the original projects realised in MATLAB. There is an
attempt to compare the properties which are made use of
in classes of digital filter designing as tools useful in a
didactic process.
II. EXAMPLES OF DESIGN SOLUTIONS
A. Using MONARCH Series DSP software
The MONARCH Series of DSP software offers a
complete set of signal and systems analysis tools for the
PC, including among others: DIGITAL FILTERS block
[2]. This module takes the filter specification, generates
the filter and immediately displays impulse and frequency
responses, and then stores the filter coefficients in an
ASCII file. A complete selection of FIR and IIR filter
architectures is provided. CODE GENERATOR block
provides highly optimized assembly language implementation for both FIR and IIR filters.
The program DIGITAL FILTERS generates the output
file containing the data which describe the designed filter
(a report file *.rpt). Five types of FIR filters can be
designed: equiripple, differentiator, Hilbert, direct and
maxflat. The order of the generated FIR filter assumes the
values within the range from 3 to 512.
IIR module enables designing an IIR filter on the basis
of the analogue prototype (choosing impulse invariant
transformation or bilinear transformation) and modelling
the filter on the basis of: the arrangement of zeroes and
poles locations, state space variables as well as the
description of filter transfer function H(z). The program
supports the design of IIR filters up to 24th order. Fig. 1
presents an exemplary Specification Screen in MONARCH. In Fig. 2 there is a report file for designing a
digital IIR Butterworth lowpass filter.
Making projects of filters of a high order is possible on
computers which are equipped with a mathematical
coprocessor because of the complexity of calculations.
Figure 1. Specification Screen of program MONARCH
(IIR Butterworth lowpass filter with 3dB maximum loss in the passband,
60dB minimum loss in the stopband, 1kHz sampling rate, 300Hz
passband cutoff frequency and 400Hz stopband cutoff frequency).
Another big drawback is the fact that this software also
lacks the windows method for FIR filter design.
B. Using QEDesign Lite Software
QEDesign Lite is an easy-to-use starter package in the
QEDesign family [3]. QEDLite supports the design of FIR
and IIR filters up to 128 coefficients and 6th order,
respectively. A C code generator is included. QEDesign
Lite supports lowpass, highpass, bandpass, and bandstop
filters.
For FIR filter design there is a possibility of selecting
the design method (windows method, equiripple - ParksMcClellan method). In the case of the FIR design with
the windows, the number of taps in the filter are
determined by the window calculation, again based on the
input specifications. The coefficients for the taps are then
determined with the use of the Fourier series design
techniques for computing the impulse response and the
window coefficients. The equiripple FIR design uses the
Remez exchange algorithm to determine an optimal
solution. This produces equiripple results in both the
passband and stopband.
For the IIR design, a normalised lowpass analogue
transfer function is generated on the basis of the given
filter specifications. This normalised analogue transfer
function is transformed via the analogue transform
formulas with the values suitably chosen for prewarping.
The unnormalised transfer functions for lowpass, highpass,
bandpass, and bandstop filters are then transformed to the
digital domain via the bilinear transformation. The
generated reports show design details, such as all
transformations from a normalised lowpass filter to a
desired filter.
The menus and dialogues of the program are largely
self-explanatory, thus allowing the system to be used with
the minimum difficulty. The user merely selects the
desired options by following the menu and dialogue
prompts. All dialogue boxes have a cancel box which will
cause the system to revert to the previous dialogue box.
In Fig. 3 an exemplary digital FIR lowpass filter with
Hanning window is shown.
QEDesign is particularly useful for FIR filter design
because it enables the use of different design methods.
C. Using MATLAB software environment
MATLAB is commonly known, especially in the
electrical engineering area [4], [5]. The Filter Design &
Analysis Tool (FDATool) is a powerful user interface for
designing and analysing filters [6]. It enables designing di-
Figure 2. The file report for IIR Butterworth lowpass filter.
gital FIR or IIR filters by setting filter specifications, by
importing filters from MATLAB workspace, or by adding,
moving or deleting poles and zeros. FDATool also
provides tools for analysing filters, such as magnitude and
phase response and pole-zero plots.
There are different ways to design filters by setting
filter specifications. One can be to choose a response type,
such as bandpass, and then choose from the available FIR
or IIR filter design methods. Or: it can specify the filter by
its type alone, along with certain frequency- or timedomain specifications such as passband frequencies and
stopband frequencies. The desired filter is then computed
with the use of the default filter design method and the
filter order. FDATool contains toolbar buttons for
controlling sessions and displaying a full view analysis,
various types of filter analyses, and what is this help.
FDATool includes buttons or fields for saving filters and
for specifying the filter method, the filter order, the filter
options, and the frequency and magnitude specifications.
Fig.4 shows filter panel with equiripple bandpass FIR
filter design.
It is worth looking closer at the projects of digital filters
realised in MATLAB on the basis of the assigned
analogue transfer function H(s). One possibility is to use
the function tf([...],[...]) in order to introduce the transfer
function H(s) in MATLAB. Then, the use of the function
c2d(H(s), sampling period, method) digitizes the analogue
transfer function H(s) to the digital transfer function H(z)
with the use of the method of designing IIR filter selected
by some user. The visualisation of the results can be made
by starting for example: fvtool (Filter Visualization Tool)
or exporting filters from MATLAB workspace to
FDATool. Fig. 5 presents the student’s project of digital
IIR Chebyshev lowpass filter using the function
impinvar([…],[..], sampling rate), which performs impulse invariance transformation.
Figure 3. The project of the digital FIR lowpass filter using QEDesign
(with Hanning window, 3dB maximum loss in the passband, 60dB
minimum loss in the stopband, 10 kHz sampling rate, 2.5 kHz passband
cutoff frequency and 4.5 kHz stopband cutoff frequency).
Figure 5. The project of the digital IIR Chebyshev lowpass filter in
MATLAB (with 1dB maximum loss in the passband, 10dB minimum
loss in the stopband, 10 Hz sampling rate, 0.1 Hz passband cutoff
frequency and 0.3 Hz stopband cutoff frequency).
Figure 4. The project of the digital FIR bandpass filter using FDATool
(equiripple design, 1dB maximum loss in the passband, 80dB minimum
loss in the stopband, 20 kHz sampling rate, 2 kHz first stopband cutoff
frequency, 3 kHz first passband cutoff frequency, 7 kHz second
passband cutoff frequency and 8 kHz second stopband cutoff frequency).
Another example of the use of M-files in MATLAB is
the students’ own program for designing the transfer
function of digital low pass filters on the basis of the
analogue transfer function. Fig. 6 shows user panel of this
program. The user enters the analogue transfer function
H(s) in the form of a polynomial and also gives sampling
frequency in Hz. Clicking on the button Transform causes
successively: taking in the data from editing fields,
computing the digital transfer function H(z) and drawing
the characteristics. The graphical output includes:
magnitude response vs. frequency in dB, phase response
vs. frequency, zeros and poles locations.
MATLAB is a programming language requiring the
basic knowledge about this environment. Solving the
designing problem requires a bigger engagement of a
student than making use of the ready-made software
packages for digital filter design.
Figure 6. The project of the digital IIR lowpass filter based on transfer
function of the analogue filter.
D. Using CommSim 7 and Multisim 2001
Other examples of the use of the packages CommSim 7
and Multisim 2001 in teaching DSP are presented on the
website http://www.am.gdynia.pl/~jagat. During the
classes in DSP students carry out the filtration of a
determined signal with the use of the selected type of filter
of the determined specification, at the same time
designing FIR and IIR filters. They design and build
analogue filters directly (with the use of ready functions)
or create analogue prototypes and then they digitize them.
An example of digital Chebyshev lowband pass filter
which was built in the environment of Multisim [7], is
shown in Fig 7. The plotter available in the package
allows registering the amplitude and phase characteristics
(Fig. 8).
Figure 7. The project of the digital IIR Chebyshev lowpass filter using
Multisim (1 kHz cutoff frequency).
Figure 8. The magnitude response of the digital IIR Chebyshev lowpass
filter in Multisim.
An example of the realisation of a FIR filter
Commsim environment [9] is presented in Fig. 9.
Figure 9. The project of the digital FIR bandpass filter using CommSim
(64th order, 30 Hz first cutoff frequency, 70 Hz second cutoff frequency).
in
TABLE I
Basic parameters of software packages for design infinite impulse
response (IIR) and finite impulse response (FIR) filters
III. FINAL REMARKS
The presented software tools used in classes of digital
filter design can be divided into two groups. The first one
are easy to use software packages designed to be intuitive
without sacrificing any of the powerful design capabilities
required for a sophisticated engineering application. The
top menu bars provide all the necessary options to design
filters and will save previously inputted data, thus
allowing specifications to be changed with the minimum
effort. Students while changing filter specifications can
examine the influence of particular parameters such as:
sampling rate, maximum loss in the passband, minimum
loss in the stopband, cutoff frequencies, filter order on the
characteristics and properties of the designed filter. When
students make use of the selected design method, they do
not have to possess any theoretical knowledge about it.
Very often a user does not have any possibility to choose
the digitisation method, as the program imposes it.
MONARCH, QEDesign, CommSim Multisim and also
FDATool in MATLAB belong to such friendly software
environment.The mentioned packages have, therefore,
many designing limits (Table I).
The other group of assisting tools for digital filter
design are the programs written in MATLAB in the form
of M-files. Writing such a program requires from a
student some knowledge of the theory of digital filter
design. Moreover, he soon becomes very fluent in programming in this environment.
IIR
Software
MONARCH
order
Analog
Prototyping:
(Impulse
Invariance and
Bilinear
Transformation)
24
QEDesign
Bilinear
Transformation
6
MATLAB
Analog
Prototyping:
(Impulse
Invariance and
Bilinear
Transformation),
Direct Design
(Yule-Walker
algorithm)
*
CommSim 7
Multisim
2001
Bilinear
Transformation
Bilinear
Transformation
20
**
Equiripple,
Differentiator,
Hilbert, Direct
and Maxflat
Windows
method,
Equiripple Parks-McClellan
method
Windows
method,
Multiband with
Transition
Bands,
Constrained
Least Squares,
Arbitrary
Response,
Raised Cosine
order
512
128
*
Windows method 32767
-
-
* memory limitation
** components limitation
[3]
[4]
REFERENCES
[5]
D. Stranneby, Digital signal processing: DSP and Applications,
Elsevier Inc, Burlington, 2001.
[2] “Digital Filters – User’s Manual”, The Monarch series, Version 2.5,
The Athena Group Inc., Gainesville, USA, 1992.
[6]
[1]
Filter methods
FIR
Filter methods
(types)
[7]
“QEDLite – Manual”, QEDesign Lite Software, Momentum Data
Systems Inc., 2000.
E. W. Kamen, B. S. Heck, Fundamentals of Signals and Systems
Using the Web and MATLAB, 2nd e., Prentice Hall, 2000.
T. P. Zielinski, From theory to digital signal processing, (in Polish),
AGH, Krakow, 2002.
“MATLAB Application Program Guide”, The Mathworks Inc.,
2000.
Interactive Image Technologies Ltd., “Commsim User Guide”, and
“Multisim 2001 User Guide”.
Download