Etter, D.M. “Computing Environments for Digital Signal Processing”
The Electrical Engineering Handbook
Ed. Richard C. Dorf
Boca Raton: CRC Press LLC, 2000
21
Computing Environments
for Digital
Signal Processing
21.1MATLAB Environment
21.2Example 1: Signal Analysis
21.3Example 2: Filter Design and Analysis
21.4Example 3: Multirate Signal Processing
Computing environments provided by many software tools and packages allow users to design, simulate, and
implement digital signal processing (DSP) techniques with speed, accuracy, and confidence. With access to
libraries of high-performance algorithms and to advanced visualization capabilities, we can design and analyze
systems using the equations and notations that we use to think about signal processing problems; we do not
have to translate the equations and techniques into a different notation and syntax. The graphics interface
provides an integral part of this design environment, and is accessible from any point within our algorithms.
Within this type of computing environment, we are more productive. But, even more important, we develop
better solutions because we have so many more tools for analyzing solutions, for experimenting with “what
if” questions, and for developing extensive simulations to test our solutions. To illustrate the power of these
environments, we present a brief description of MATLAB, one of the most popular technical computing
environments in both industry and academia, and then present three examples that use MATLAB.
21.1 MATLAB Environment
MATLAB is an integrated technical environment designed to provide accelerated DSP design capabilities. In
addition to the basic software package that contains powerful functions for numeric computations, advanced
graphics and visualization capabilities, a high-level programming language, and tools for designing graphical
user interfaces (GUI), MATLAB also provides a number of application-specific toolboxes that contain special-
ized libraries of functions. The discussion and examples that follow in this article use capabilities from the
Signal Processing Toolbox. Other toolboxes that are applicable to solving signal processing problems include
the following: Control Systems, Frequency Domain System Identification, Fuzzy Logic, Higher-Order Spectral
Analysis, Image Processing, LMI (Linear Matrix Inequality) Control, Model Predictive Control, m-Analysis and
Synthesis, Neural Networks, Optimization, Partial Differential Equations, QFT (Quantitation Feedback Theory)
Control, Robust Control, Signal Processing, Splines, Statistics, Symbolic Math, System Identification, and
Wavelets.
An interactive environment for modeling, analyzing, and simulating a wide variety of dynamic systems is
also provided by MATLAB through SIMULINK—a graphical user interface designed to construct block diagram
Delores M. Etter
University of Colorado
? 2000 by CRC Press LLC
models using “drag-and-drop” operations. Simulations of the block diagrams can be used to test a number
of “what-if” questions. Special purpose block libraries are available for DSP algorithm development, and include
a DSP Blockset, a Fixed-Point Blockset, and a Nonlinear Control Design Blockset.
In order to bridge the gap between interactive prototyping and embedded systems, MATLAB has developed
a compiler to generate optimized C code from MATLAB code. Automatic C code generation eliminates manual
coding and algorithm recoding, thus providing a hierarchical framework for designing, simulating, and pro-
totyping DSP solutions.
21.2 Example 1: Signal Analysis
One of the most common DSP applications is the analysis of signals that have been collected from experiments
or from a physical environment. These signals are typically stored in data files, and often need preprocessing
steps applied to them before we are able to extract the desired information. Preprocessing can include removing
means or linear trends, filtering noise, removing anomalies, and interpolating for missing data. Once the data
is ready to analyze, we are usually interested in statistical information (mean, median, variance, autocorrelation,
etc.) along with an estimate of the distribution of the values (uniform, Gaussian, etc.). The frequency content
of a signal is also important to determine; if the signal is non-stationary, the frequency content needs to be
determined using short time windows.
To illustrate the use of MATLAB in computing some of the steps mentioned above, we use a speech signal
collected at 8 kHz. After loading the signal from a data file, we will remove any linear trend that might have
been introduced in the collection process (this also removes any constant term). Figure 21.1 contains a plot of
the signal which clearly shows the time-varying nature of the signal. Figure 21.2 contains a histogram of the
distribution of the values, showing that the values are closer to a Laplacian or Gamma distribution than to a
uniform or Gaussian distribution. Figure 21.3 contains a spectogram which displays the frequency content of
the signal computed using short overlapping time windows. The MATLAB code that generated these plots is
shown in Fig. 21.4. This code illustrates some of the important characteristics of high-level computational tools.
The fundamental data structure is a matrix, and all operations and functions are designed to work with matrices.
Hence, loops are rarely necessary, and thus the code is generally much shorter, more readable, and more self-
documenting.
FIGURE 21.1
FIGURE 21.2
? 2000 by CRC Press LLC
21.3 Example 2: Filter Design and Analysis
MATLAB gives us a number of different options for designing both IIR and FIR digital filters. We can design
classical IIR filters (Butterworth, Chebyshev type I, Chebyshev type II, and elliptic) that are lowpass, highpass,
bandpass, or bandstop filters. We can also use other techniques, such as the Yule-Walker technique, to design
IIR filters with arbitrary passbands. Several techniques allow us to design FIR filters using windowed least
squares techniques. The Parks-McClellan algorithm uses the Remez exchange algorithm to design filters with
FIGURE 21.3
FIGURE 21.4
? 2000 by CRC Press LLC
an optimal fit to an arbitrary desired response. Once a filter is designed, it can be easily translated to other
forms, including transfer functions, impulse responses, and poles/zeros.
Assume that we are going to analyze the dial tones from a telephone network that uses dual-tone multifre-
quency (DTMF) signaling. In this system, pairs of tones are used to signal each character on the telephone
keypad. For example, the digit 1 is represented by tones at 697 Hz and 1209 Hz. All of the tones are between
697 Hz and 1633 Hz. Thus, before analyzing the signal to determine the two tones that it contains, we might
want to filter out all signals outside of the band that contains all possible tones in order to increase the signal-
to-noise ratio. In this example, we design a bandpass filter with a passband between 500 Hz and 1800 Hz.
Designs are compared using an elliptic IIR filter of order 8 and a causal FIR filter of order 70. Figure 21.5
contains magnitude plots of the two filters, and clearly shows the characteristics of the filters. The elliptic filter
has sharp transitions with ripple in the passband and in the stopband, while the FIR filter (which also uses a
Hamming window) is flat in the passband and the stopband, but has wider transition bands. Figure 21.6 contains
the group delays for the two filters. The FIR filter has a linear phase response, and thus the group delay is a
fixed value of 35 samples; the IIR filter has a nonlinear phase, but has a relatively constant delay in the passband.
Figure 21.7 contains the corresponding impulse responses, illustrating the finite impulse response of the FIR
filter and the infinite impulse response of the IIR filter. Figure 21.8 contains the pole/zero plot for the IIR
solution. The code for performing the designs and generating all the plots is shown in Fig. 21.9.
FIGURE 21.5
FIGURE 21.6
? 2000 by CRC Press LLC
21.4 Example 3: Multirate Signal Processing
Given a signal that has been collected or computed using a process that eliminates or minimizes aliasing from
components above the Nyquist frequency (one-half the sampling frequency), we have a great deal of flexibility
in modifying the sampling rate. For example, if the frequency content of the signal is much lower than the
Nyquist frequency, then the sampling rate can be reduced without losing any of the signal content. This
“decimation” process allows us to compress the signal into a form that requires less memory requirements. An
“interpolation” process can be used to interpolate new data points between points of the decimated signal in
such a way that the frequency content of the new signal is essentially the same as the original signal. The
decimation process requires a reduction of data points by an integer factor, M, such as a factor of 3. The
FIGURE 21.7
FIGURE 21.8
? 2000 by CRC Press LLC
interpolation process requires that an integral number of points, L-1, be interpolated between existing points,
such as interpolation of 5 new points between existing pairs of points. The decimation process increases a
sampling interval by M, and the interpolation process decreases a sampling interval by a factor of L. MATLAB
contains functions for decimation and interpolation, as well as a function for a resampling of a signal using a
non-integer factor of P/Q where P and Q are integers.
Consider a signal that is one sinusoid modulated by another sinusoid. The signal has been sampled at a
frequency chosen to provide efficient storage of the data. However, when plotting the data for further analysis,
we want to interpolate by a factor of 8 so that the signal looks smoother. Therefore, we use the MATLAB
interpolation function. Figure 21.10 contains plots of the original and interpolated time signals. Figure 21.11
contains frequency plots to confirm that the interpolation did not significantly affect the frequency content.
Figure 21.12 contains the MATLAB code for this process.
FIGURE 21.9
? 2000 by CRC Press LLC
Defining Terms
Drag and drop operation: Graphical operation for building diagrams by selecting, copying, and moving icons
using a mouse or track ball.
Graphical user interface (GUI): Interface using pull-down menus, push buttons, sliders, and other point-
and-click icons.
Toolbox: Library of specialized functions.
“What if ” question: Question that allows a user to determine the effect of parameter changes in a problem
solution.
FIGURE 21.10
FIGURE 21.11
? 2000 by CRC Press LLC
Related Topics
14.3 Design and Implementation of Digital Filters ? 14.4 Signal Restoration ? 15.1 Coding, Transmission, and
Storage
References
Buck, Daniel, and Singer, Computer Explorations in Signals and Systems Using MATLAB, Englewood Cliffs, N.J.:
Prentice-Hall, 1997.
Burris, McClellan, and Oppenheim, Computer-Based Exercises for Signal Processing, Englewood Cliffs, N.J.:
Prentice-Hall, 1994.
Etter, Engineering Problem Solving with MATLAB, 2nd ed., Englewood Cliffs, N.J.: Prentice-Hall, 1997.
Etter, Introduction to MATLAB for Engineers and Scientists, Englewood Cliffs, N.J.: Prentice-Hall, 1996.
Garcia, Numerical Methods for Physics, Englewood Cliffs, N.J.: Prentice-Hall, 1994.
Hanselman and Kuo, MATLAB Tools for Control System Analysis and Design, 2nd ed., Englewood Cliffs, N.J.:
Prentice-Hall, 1995.
Jang, Sun, and Mizutani, Neuro-Fuzzy and Soft Computing: A Computational Approach to Learning and Machine
Intelligence, Englewood Cliffs, N.J.: Prentice-Hall, 1997.
Kamen and Heck, Fundamentals of Signals and Systems Using MATLAB, 2nd ed., Englewood Cliffs, N.J.: Prentice-
Hall, 1997.
Marcus, Matrices and MATLAB: A Tutorial, Englewood Cliffs, N.J.: Prentice-Hall, 1993.
Polking, Ordinary Differential Equations Using MATLAB, Englewood Cliffs, N.J.: Prentice-Hall, 1995.
Van Loan, Introduction to Scientific Computing: A Matrix Vector Approach Using MATLAB, Englewood Cliffs,
N.J.: Prentice-Hall, 1997.
FIGURE 21.12
? 2000 by CRC Press LLC
Further Information
For further information on MATLAB, here are e-mail addresses, WWW sites, and other resources locations:
E-mail addresses:
news-notes@mathworks.com (MATLAB News & Notes editor)
support@mathworks.com (technical support for all products)
info@mathworks.com (general information)
Web sites:
http://www.mathworks.com (the MathWorks home page)
http://education.mathworks.com (educational products and services)
Other resources:
ftp.mathworks.com (FTP server)
comp.soft-sys.matlab (usenet newsgroup)
? 2000 by CRC Press LLC