(Freely Distributable) (All Rights Reserved by the Georgia Tech Research Corporation) Signal Processing Packages (SPP) and Notebooks 2.9.5 for Mathematica Version 1.2 and higher by Brian Evans 211-105 Cory Hall Dept. of Electrical Engineering and Computer Sciences University of California Berkeley, CA 94720 and James McClellan, Kevin West, Wallace McClure, Lina Karam, Joe Winograd, Todd Bacon, James Proctor, and Terrence Crone Digital Signal Processing Laboratory School of Electrical and Computer Engineering Georgia Institute of Technology Atlanta, GA 30332-0250 2/4/94 Primary E-mail Contact: ble@ohm.eecs.berkeley.edu Home Archive Site: gauss.eedsp.gatech.edu (IP #130.207.226.24) TABLE OF CONTENTS Line Introduction .......................................... 67 Index of Files ........................................ 90 Installation on an IBM PC .............................. 128 Installation on a NeXT Machine ........................ 156 Installation on a Unix Workstation Other Than a NeXT ... 172 Installation on a Macintosh ........................... 195 Macintosh Users ....................................... 206 Warning ............................................... 217 Related Archive Sites ................................. 232 Getting started ....................................... 254 Transform Capabilities ................................ 292 Knowledge Representation for Signals and Systems ...... 314 Other Abilities of These Packages ..................... 334 Signal Processing Notebooks ........................... 348 Alteration of Standard Mathematica Routines ........... 375 Disclaimer and Future Releases ........................ 382 Suggestion ............................................ 403 Documentation ......................................... 412 References on the Signal Processing Packages .......... 424 References on the Signal Processing Packages and Notebooks 440 References on Transforms .............................. 463 References on Symbolic Signal Processing .............. 486 ---> Introduction The signal processing packages implement many concepts from linear systems theory, esp. linear transforms and convolution. The linear trans- forms, such as Laplace and Fourier transforms in continuous time and the z-transform and others in discrete time, are implemented symbolically in one-dimension and multiple dimensions. The discrete-time and continuous- time convolution algorithms implement symbolic piecewise convolution in one dimension. Accompanying the signal processing packages (code) are several notebooks (electronic documents) which are organized in three directories: "Handouts" for class handouts, "Help" for on-line help, and "Tutorial" for interactive tutorials. The notebooks providing on-line help are README, SignalProcessingExamples, SignalProcessingIntroduction, and SignalProces- singUsage. (The SignalProcessingIntroduction notebook is an excellent starting place for learning about Mathematica and the signal processing packages). The tutorial notebooks are AnalogFilters, DTFT, Piecewise- Convolution, and zTransform (in three parts). A complete set of references appears at the end of this file. Please send any questions, comments, or bug reports to the primary author, Brian Evans, at ble@ohm.eecs.berkeley.edu. ---> Index of Files The archive files that contain the signal processing packages and notebooks for Mathematica are: SigProc2.0.tar.Z binary compressed tar file for Unix systems SigProc2_IBM_PC.zip binary zip file for the IBM PC running MS-DOS SigProc2.0.mac.sea.hqx ascii binhexed self-extracting archive for Mac Please transfer these files as indicated above. In the case of the IBM PC version, the release was loaded on to a PC, zipped, and reloaded on the FTP site. All of the file names have been truncated so that they are unique. In the case of the Mac version, the release was loaded on to a Macintosh--- the files were then converted to Mathematica format and archived using Compact Pro 1.3.1 into one self-extracting archive. The self-extracting archive was then run through BinHex 4.0 and copied as an ASCII file to the FTP site. Other files of interest are: CHANGES text file documenting changes in code CHANGES.SUMMARY text file summarizing changes in code FTP-Info-Mma-notebook a notebook on FTP sites and FTP instructions Mathematica1.2 directory of notebooks in Mma 1.2 format README this text file OtherNotebooks.tar.Z notebooks from Stanford/CCRMA, NCSU, WSU, and Apple Inc. (see "Related Archive Sites Below") VERSIONx.x_x indicates the FTP site has version x.x.x c-src.tar a tar file of useful C programs evans_thesis.ps a PostScript version of Brian Evans' thesis [9] math.el configuration file for Emacs so that Emacs becomes a front-end to Mathematica unzip.exe public domain IBM PC zip archive extractor usage.ps PostScript version of the reference guide usage.tex TeX version of the reference guide usersguide.ps PostScript version of the user's guide usersguide.tex TeX version of the user's guide ---> Installation on an IBM PC After downloading "SigProc2_IBM_PC.zip", which will be truncated "SigProc2.zip" on a PC, move the zip file to a directory other than the one in which Mathematica is installed. Then, type ms-dos> unzip -d SigProc2.zip You can see all of the possible options for unzip by typing just "unzip". If your machine cannot find "unzip", try "pkunzip". If that fails, then acquire a copy of "unzip" (which is public domain and resides on FTP site gauss.eedsp.gatech.edu) or "pkunzip" (which is shareware). The unzipped archive will produce a Packages and a Notebooks directory. You will need to edit Mathematica's "init.m" file to add the new directory to the path. The Mathematica command for this is $Path = Append[$Path, ]; where is the new directory path surrounded by double quotes, e.g., "d:\math\local\packages". Under MicroSoft windows, Mathematics needs a minimum of 8 Mb of memory to run the notebook interface and the kernel. The integration rules require another 1 Mb and the signal processing packages need another 3 Mb. Therefore, please run Mathematica with at least 12 Mb of unused memory. Mathematica, which does not have a .pif file, will have access to all of the free memory on your PC, virtual and RAM. ---> Installation on a NeXT Machine Move the file "SigProc2.0.tar.Z" into a temporary directory. Then evaluate the Unix commands "uncompress SigProc2.0.tar.Z" and then "tar xf SigProc2.0.tar". It will create a Packages and a notebooks directory. To move them to a standard place, type the following Unix commands (or use the directory browser): NeXT-Unix> cp -r Packages /LocalLibrary/Mathematica NeXT-Unix> cp -r Notebooks /LocalLibrary/Mathematica The SPP will be in /LocalLibrary/Mathematica/Packages/SignalProcessing and the SP notebooks will be /LocalLibrary/Mathematica/Notebooks in the sub- directories Handouts, Help, and Tutorials. ---> Installation on a Unix Workstation Other Than a NeXT Move the file "SigProc2.0.tar.Z" into a temporary directory. Then evaluate the Unix commands "uncompress SigProc2.0.tar.Z" and then "tar xf SigProc2.0.tar". It will create a Packages and a Notebooks directory. To move them to a standard place, type the following Unix commands: Unix> cp -r Packages /usr/local/math If you cannot write to /usr/local/math, then put the packages in another directory and edit Mathematica's "init.m" file to add the new directory to Mathematica's $Path variable by saying "$Path = Append[$Path, ]" where is the new directory. Now that there is a notebook interface for X windows, you can move the notebooks to a "standard" place by evaluating Unix> cp -r Notebooks /usr/local/math If you do not have the notebook front end or the notebook reader for your Unix workstation, then you can discard the notebooks (for documentation, please refer to the LaTeX files "usage.tex" and "usersguide.tex"). ---> Installation on a Macintosh Download "SigProc2.0.mac.sea.hqx" to your Macintosh in a temporary directory. Run BinHex 4.0 on it (with the Text Filter option disabled) to produce "SigProc2.0.mac.sea" which is a self-extracting archive. Now, double click on the .sea file, and it will produce a Packages and Notebooks folder. Move the SignalProcessing folder in the Packages folder to Mathe- matica's Packages folder. You can keep the Notebooks anywhere you want such as in one of the Mathematica folders. Also, please see the note below. ---> Macintosh Users Please let Mathematica allocate as much memory as possible. I give it 9000 kb. You can check the value by clicking once on the Mathematica icon and select the Get Info option from the Finder's File menu. It is the number that appears in the lower left-hand corner of the info window. If you are using Mathematica 1.2, please make sure that the start up procedure includes the loading of the Elliptic functions, symbolic inte- gration, and Series packages. ---> Warning A warning about opening some notebooks under Mathematica 2.0. The signal processing Notebooks appear in their ASCII forms. The binary side information like graphic bit maps are not included so Mathematica will have to regenerate them from the ASCII Notebook. In Mathematica 2.0 and higher, the Notebook will generate all missing bit maps for graphics contained in a Notebook, and it will inform the user by saying "Rendering ..." in the header of the window containing the Notebook. Each bit map roughly adds 20 kb to the memory required by the Notebook. The bit maps are NOT stored with the Notebook. Mathematica 1.2 only generates missing bit maps as needed (i.e., when you want to see the picture) but it saves the bit maps with the Notebook so as to increase its size. ---> Related Archive Sites The three primary FTP archive sites for Mathematica extensions are: mathsource.wri.com, yoda.physics.unc.edu, and otter.stanford.edu. An additional set of related Notebooks is available in the same anonymous FTP site (gauss.eedsp.gatech.edu or IP # 130.207.226.24) in the compressed tar file "StanfordNotebooks.tar.Z" (which is also available for the PC in zip form as well). These three Notebooks investigate the use of windows in masking data and designing filters. Another set of Notebooks that describe cochlear signal processing and analog filter design, written by Malcolm Slaney, are available from Apple Inc. via anonymous FTP to ftp.apple.com or yoda.physics.unc.edu. They are also in the "OtherNotebooks.tar.Z" file on gauss.eedsp.gatech.edu. A disk copy and a hardcopy of the Notebooks can be obtained free of charge by sending e-mail to corp.lib@applelink.apple.com. A set of controls packages (COSYPAK) has been developed that was originally based on a subset of the signal processing packages (now they are standalone packages). Accompanying COSYPAK is a set of Notebooks (COSYNOTES) that follow Ogata's 1991 text "Modern Control Theory". COSYPAK and COSYNOTES is available from mathsource.wri.com. ---> Getting started The Mathematica file "Master.m" loads in all the necessary files under Mathematica 1.2 but only tells Mathematica 2.0 where to find all of the new routines. Load it in by Needs["SignalProcessing`Master`"]. The one-dimensional/two-dimensional signal analyzing functions DSPAnalyze and ASPAnalyze are good examples of the code's ability to switch between symbolic, numeric, and graphical representations (the hooks being provided by Mathematica). The four symbolic transform objects ZTransform, InvZTransform, InvLaPlace, and LaPlace demonstrate their ability to handle multidimensional transforms and the region of conver- gence. (The other transform objects are CTFTransform, InvCTFTransform, DFTransform, InvDTFTransform, DTFTransform, and InvDTFTransform.) All of the transforms can completely justify their answers by displaying each step of the transformation process (use the option Dialogue -> True). Besides the examples in the ICASSP '90 paper, [1] try 1. ASPAnalyze[ t Exp [ - 4 t / 5 ] Cos [ 3 Pi t / 4 ] CStep[t], t ] 2. DSPAnalyze[ n (4/5)^n Step[n], n ] 3. DSPAnalyze[ (4/5)^n1 Impulse[n1 - n2] Step[n1,n2], {n1,n2} ] 4. ASPAnalyze[ Exp[- 4 t1 / 50] Delta[t1 - t2] CStep[t1,t2], {t1,t2} ] 5. DSPAnalyze[ (1/2)^n1 (2/5)^n2 Multinomial[n1,n2] Step[n1,n2], {n1,n2} ] Note that the analog analyzer (ASPAnalyze) only displays the interesting section of magnitude and phase plots (part encompassing the breakpoints). Also, note that two-dimensional pole-zero plots are actually root maps, unless the two-dimensional transform is separable (then two pole-zero plots will be displayed). Note that a. Delta is the Dirac delta function, b. Impulse is the unit Kronecker delta function, and c. Mathematica's Laplace transform is LaplaceTransform whereas mine is simply LaPlace. The paper entitled "Symbolic Transforms with Applications to Signal Processing" [2] gives Mathematica output for four of the examples above. ---> Transform Capabilities Fourier, Laplace and z-transforms are useful for analyzing linear systems and signal processing operations. We have implemented packages for all the transforms commonly used in signal processing: (discrete signals) z-transform discrete-time Fourier transform discrete Fourier transform (continuous signals) Laplace transform Fourier transform This implementation of the transforms is very general in that multi- dimensional versions. The packages also track properties of the trans- forms, so it is also possible to deduce the stability or instability of a linear system. Using the transforms, the packages can solve linear constant-coefficient difference and differential equations for right-sided (defined for t > t0) and left-sided (defined for t < t0) functions. ---> Knowledge Representation for Signals and Systems We have added many functions (signal primitives) and operators (system primitives) that are common in signal processing and linear systems theory but missing in Mathematica: (basic signals) Kronecker impulse, Dirac delta, sinc, continuous and discrete step functions, continuous and discrete pulse functions, aliased sinc, filter representations (basic operators) aliasing, convolution, DFT, DTFT, backward difference, downsampling, Fourier transform, interleave samples, Laplace transform, periodic, reverse, scale axis, shift, summation, upsampling The transform packages support all of these new objects. ---> Other Abilities of These Packages (continuous signals) analog 1-D filter design 1-D piecewise convolution plots of 1-D and 2-D signals (discrete signals) 1-D convolution plots of 1-D and 2-D sequences (general plotting) pole-zero diagrams root loci frequency responses ---> Signal Processing Notebooks In order to extend the use of these extensions in the educational environment, we have written several Notebooks on subjects that are studied in transform theory and signal processing courses: (tutorial Notebooks) z-transform (in three parts) piecewise convolution analog filter design discrete-time Fourier transform (directed help/guide) signal processing examples introduction to Mathematica and SP packages Mathematica as an educational tool Laplace transform (reference guide) signal processing usage information In the tutorial Notebooks, we give numerous examples such as might be found in a standard textbook and solve problems that are at the level of elementary homework problems. We use the Notebook's animation ability whenever possible. In the analog filter design Notebook, for example, we illustrate the dependence of the filter's magnitude response on the filter order (and elsewhere on the ripple control parameter) as an animation sequence. ---> Alteration of Standard Mathematica Routines 1. the first argument to ClearAttributes and SetAttributes is held, 2. the determinant Det of a number is that number, and 3. the dot product (Dot) of two numbers is their product. ---> Disclaimer and Future Releases This software is the property of the Georgia Tech Research Cor- poration. We agreed to let Wolfram Research Inc. (WRI) to distribute the packages and Notebooks free of charge through MathSource. The Mathematica Journal (published by Addison-Wesley) distributed Version 1.0 of the SPP as part of its electronic supplement to issue #2 of volume 1. NeXT Inc. also distributed Version 2.7 of the SPP and SPN in its Higher Education CD ROM. I would like to know if you find bugs in it. I have stopped mailing new releases since I post updated code in anonymous FTP locations. Brian L. Evans ble@ohm.eecs.berkeley.edu 211-105 Cory Hall, Dept. of EECS, University of California, Berkeley, CA 94720 James H. McClellan mcclella@eedsp.gatech.edu School of Electrical & Computer Engineering, Georgia Inst. of Tech., Atlanta, GA 30332-0250 ---> Suggestion Please, please, use lower case one-letter symbols as variables and do not assign values to them. This includes variables like n, t, x, and y, as well as t1, t2, etc. Use one-letter upper case variables to represent constants (A, G,...), although Mathematica reserves I and N and we reserve L and Z. ---> Documentation Most of the documentation is in notebook format. Since many users do not have access to the notebook interface, I have also include two LaTeX files: "usage.tex" (reference guide) and "usersguide.tex". Another option is to find a Macintosh computer and acquire MathReader (from the FTP site mathsource.wri.com under the pub/Utilities/Macintosh directory) which is a public domain notebook reader. MathReader will at least allow you to peruse notebooks, but you will be unable to evaluate any algebraic expressions written in the Mathematica language. ---> References on the Signal Processing Packages 1. Evans, Brian, James McClellan, and Wallace McClure. "Symbolic Trans- forms Using DSP Knowledge Bases", Proc. of the 1990 IEEE Inter. Conf. on Acoustics, Speech, and Signal Processing. pp. 1775-1778. 2. Evans, Brian, James McClellan, and Wallace McClure. "Symbolic Trans- forms with Applications to Signal Processing". Mathematica Journal. vol. 1, issue #2. Dec., 1990. pp 70-80. 3. Evans, Brian, and James McClellan. "Transforms for Signal Processing". 1991 Mathematica Conference. Jan., 1991. 4. West, Kevin, and James McClellan. "Symbolic Convolution". IEEE Trans. on Education, vol. 36, no. 4, pp. 386-393, Nov., 1993. ---> References on the Signal Processing Packages and Notebooks 5. Evans, Brian, James McClellan, and Kevin West. "Mathematica as an Educational Tool for Signal Processing". Proc. IEEE Southeastern Conference (Southeastcon). April, 1991. pp. 1162-1166. 6. Evans, Brian, and James McClellan. "Symbolic Analysis of Signals and Systems", ch. 3 of Symbolic and Knowledge-Based Signal Processing ed. by Alan Oppenheim and Hamid Nawab. Prentice Hall, Englewood Cliffs (NJ), May, 1992. 7. Evans, Brian, Lina Karam, Kevin West, and James McClellan. "Learning Signals and Systems with Mathematica." IEEE Transactions on Education Feb. 1993, vol. 36, no. 1, pp. 72-78 8. Evans, Brian, James McClellan, and Joel Trussell, "Investigating Signal Processing Theory with Mathematica," Int. Conf. on Speech, Acoustics, and Signal Processing, April, 1993. vol. I, pp. 12-15. 9. Evans, Brian. "A Knowledge-Based Environment for the Analysis and Design of Multidimensional Multirate Signal Processing Algorithms." Ph. D. Thesis, Georgia Tech, June, 1993. ---> References on Transforms 10. Clements, Mark, and Jerrold Pease. 1989. "On Causal Linear Phase IIR Digital Filters," IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. ASSP-37, issue #4, pp. 479-484. 11. Churchill, Ruel. 1958. Operational Mathematics. McGraw-Hill, New York. 12. Dudgeon, Dan, and Russel Mersereau. 1984. Multidimensional Digital Signal Processing. Prentice Hall, Englewood Cliffs (NJ). 13. Muth, Eginhard. 1978. Transform Methods. Prentice Hall, Englewood Cliffs (NJ). 14. Oberhettinger, Fritz, and Larry Badii. 1973. Tables of Laplace Trans- forms. Springer-Verlag, New York. 15. Oppenheim, Alan and Alan Willsky. 1983. Signals and Systems. Prentice Hall, Englewood Cliffs (NJ). 16. Oppenheim, Alan, and Ronald Schafer. 1989. Discrete-Time Signal Pro- cessing. Prentice Hall, Englewood Cliffs (NJ). ---> References on Symbolic Signal Processing 17. Covell, Michele. 1989. An Algorithm Design Environment for Signal Pro- cessing. Ph.D. Thesis and RLE Tech. Rep. #549. MIT, Cambridge (MA). 18. Kopec, Gary. 1980. "The Representation of Discrete-Time Signals and Systems in Programs." Ph.D. Thesis. MIT, Cambridge (MA). 19. Kopec, Gary. 1985. "The Signal Representation Language SRL." IEEE Trans. on Acoustics, Speech, and Signal Processing, vol. ASSP-33, issue #4, pp. 921-932. 20. Myers, Cory S. 1986. "Signal Representation for Symbolic and Numeric Processing" Ph.D. Thesis and RLE Tech. Rep. #521. MIT, Cambridge, MA. 21. Oppenheim, Alan, and Hamid Nawab, eds. {Symbolic and Knowledge-Based Signal Processing}. Prentice Hall: Englewood Cliffs, NJ. 1992.