Etter, D M. Computing Environments for Digital Signal Processing The electrical Engineering Handbook Ed. Richard C. Dorf Boca raton crc Press llc. 2000
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.1 MATLAB Environment 21.2 Example 1: Signal Analysis Delores m. etter 21.3 Example 2: Filter Design and Analysis University of Colorado 21.4 Example 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 ter 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( GUD), 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, u-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 c 2000 by CRC Press LLC
© 2000 by CRC Press LLC 21 Computing Environments for Digital Signal Processing 21.1 MATLAB Environment 21.2 Example 1: Signal Analysis 21.3 Example 2: Filter Design and Analysis 21.4 Example 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 specialized 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
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 analys 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 ly 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 he 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. Speech Signal FIGURE 211 Distribution of Speech Values 010.15 FIGURE 21.2 c 2000 by CRC Press LLC
© 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 prototyping 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 selfdocumenting. FIGURE 21.1 FIGURE 21.2
Speech Signal 2000 FIGURE 21.3 s These MATLAB statements read and process a speech file clear, clf 8 clear memory and figure window load speech. dat 8 load speech data file 8 specify sampling time detrend(speech); 8 remove mean and linear trend fram speech N B determine the mmber of speech points t=(0:N-1)*r; 8 specify time sigmal in seconds 8 plot speech signal ubplot(2,1,1), plot(t, s),title(' Speech Signal.) xlabel(Time, s'), gria, pause g determine and plot histogram of speech sigmal using 25 bins 各 clf subplot(2, 1,1), hist(s, 25), title(Distributian of Speech Values),grid, pause plot a spectogram of the signal using windows of 256 pts specgram(s, 256, 8000),title( Speech Signal),pause FIGURE 21.4 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 L, Chebyshev type II, and elliptic) that are lowpass, highpass, andpass, or bandstop filters. We can also use other techniques, such as the Yule-Walker technique, to desig 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 c 2000 by CRC Press LLC
© 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
Comparison of R and FIR Filters 100015002000250030003500 FIGURE 21.5 Group Delay· IIR Filter 50020002500300035004000 roup Delay· FIR Filter FIGURE 21.6 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 eypad. 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 ontains 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. c 2000 by CRC Press LLC
© 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 multifrequency (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 signalto-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