Summary of the Changes to the Signal Processing Packages and Notebooks for the Mathematica Environment Brian Evans James McClellan 211-105 Cory Hall Digital Signal Processing Group Dept. of Electrical Engineering School of Electrical and and Computer Sciences Computer Engineering University of California Georgia Institute of Technology Berkeley, CA 94720 Atlanta, GA 30332-0250 E-MAIL: ble@ohm.eecs.berkeley.edu 2/4/94 Since the version of the signal processing packages released by _The Mathematica Journal_ in the Fall of 1990, I have made changes to every file and added many new ones. The major changes implemented by the new version of the signal processing packages are listed by topic in the "SignalProcessingExamples" notebook and summarized in the file "CHANGES.SUMMARY". This file lists the changes version by version. Since the version of the signal processing packages released by The Mathematica Journal, I have made changes to every file. The following highlights those changes. The packages work simultaneously under Mathematica 1.2, 2.0, 2.1, and 2.2. Under Mathematica 2, evaluating Needs[ "SignalProcessing`Master`" ] tells Mathematica where to find all of the new routines so that they can be automatically loaded when referenced. When routines load, their 1-D definitions are evaluated. If multidimensional features are requested, then those definitions would be automatically loaded. This decoupling means that undergraduates using the extensions would need less memory. For example, one-dimensional and separable multidimensional z-transforms require 1/3 less memory. --> Integration o Integration rules for Delta functions are now covered by DeltaIntegrate. Users can customize them by attaching rules to DeltaIntegrate (but first you will need to unprotect it). o Integration is now more robust for expressions involving continuous step (CStep) functions and continuous pulse (CPulse) forms. o Integration is now more robust for Delta functions. --> Expression Simplification o Added SPSimplify which applies simplification rules for signal processing expressions. It supports a dialogue option: Dialogue -> False no justification Dialogue -> True some justification Dialogue -> All complete justification o You can specify a list of symbols for SPSimplify to treat as real-valued variables by using the Variables option. o SPSimplify supports the same options as Simplify does (e.g., the Trig option in Mathematica 2 and higher). --> New Plotting Routines o SignalPlot plots the real and imaginary components of a 1-D function simultaneously on the same plot, as well as Dirac delta functions. The variable $DeltaFunctionScaling directs how Dirac delta functions are to be plotted. A value of None means that the height of all Dirac delta functions will be equal to the maximum value of the plot. A value of Scaled means that the height of Dirac delta functions will be proportional to their area. SignalPlot also plots 2-D signals. o SequencePlot which plots 1-D and 2-D discrete-time expressions; it supports the same options as does Plot including PlotStyle. o MagPhasePlot plots the magnitude and phase response. Results of Fourier transforms can be passed directly to the routine. The MagRangeScale option specifies whether the range of the magnitude plot will be in decibel (MagRangeScale -> Log) or linear (MagRangeScale -> Linear) scale. The DomainScale indicates how to display the independent axes: Log for logarithmic and Linear for linear scale. The PhaseRangeScale option can be either Degree or Radian. o RootLocus plots a root locus for one varying parameter o All new plotting routines support the same options as does Plot. o PoleZeroPlot shades the region of convergence for s-domain plots. o When an invalid region of convergence (ROC) is given to PoleZeroPlot, it will display the union of all possible ROC's. o PoleZeroPlot returns either a list of poles (if the Return -> Roots option is used) or the pole-zero plot(s) (if the Return -> Graphics option is used). o SmithChartPlot plots an impedance function on a Smith chart. --> Convolution o Either "function" argument can be in piecewise form (as a list of F-intervals) or algebraic notation (as a formula) o Discrete and continuous convolution is performed by PiecewiseConvolution which calls either CTPiecewiseConvolution or DTPiecewiseConvolution depending on the value of the Domain option (Discrete or Continuous). The default Domain option is the value of $ConvolutionDomain. o The discrete linear convolution operator is represented by Convolve[n] and the continuous linear convolution operator is denoted CConvolve[t]. These are merely representations of operations used by the transform rules bases; that is, they do not actually perform convolution. o For discrete convolution, the endpoints of the intervals of the functions being convolved must be each either be infinity, integer, or symbolic. Any real number appearing as an endpoint will be converted to an integer. o For continuous convolution, the endpoints of the intervals of the functions being convolved must be infinity, real-valued, or symbolic. o The discrete and continuous convolution support a Dialogue with three levels of dialogue: False, True, or All. For True, an animation sequence is generated representing the flip-and-slide approach to solving the current convolution problem. For All, the animation sequence shows two plots per frame--- the upper plot is the flip-and-slide approach to convolution and the lower plot is the overlap between the two functions being convolved with the delay value indicated in the header of the plot. When Dialogue is True or All, a legend is displayed. o A new option for the convolution routines, ConvolutionOutpuForm, directs the routines to return the convolution in piecewise form (the default) or an algebraic form. o The routine VectorConvolution performs the flip-and-slide convolution of two sampled signals represented as two vectors of sample values. The sample values can be of any data type including symbolic. --> Transforms o All transform rule bases can justify their answers. The level of justification is set by the Dialogue option (see above). o The transform rule bases recognize convolution and summation operators o The inverse z- and Laplace transforms rely on Mathematica's partial fractions routine Apart which is not robust. I have written MyApart which will be used by the transform rule bases whenever Apart does not finish the decomposition. By default, MyApart will root denominators higher than 5th-order numerically. o The forward z-transform handles multidimensional downsampling and upsampling operations. o The inverse DTFT recognizes transforms that are multidimensionally upsampled in the discrete-time domain. o The forward and inverse continuous-time Fourier transforms use the same set of rules by exploiting the duality property. o The Fourier transforms handle infinite impulse trains (represented as either Summation[n,-Infinity,Infinity,1][Delta[t + n T]] or Periodic[T,t][Delta[t]]). Aspects of sampling theory can now be shown. o The forward discrete-time Fourier transforms explicitly track periodicities of frequency responses. o All of the transform rule bases support an option called Definition. If True, then the rule base will apply the definition of the transform (using Mathematica's built-in routines for symbolic integration or symbolic summation) if all other attempts at the transform have failed. o Regardless of the value of the Dialogue option, the transform rule bases will keep track of the assumptions made on the free parameters. They can be retrieved at any time by evaluating Assuming[All]. The set of conditions can be cleared by evaluating Assuming[]. o New operator called CircularShift which is an abstract form of the primitive RotateRight. It was introduced because of the new DFT transform pairs written into the DFT rule bases. o I have idiot-proofed the transform rule bases. So, if you typed something like LaPlace[ CStep[t], t s ] it would complain about t s because you meant t, s. This should help new users. o The TransformLookup option for the transform rule bases allows one to specify additional transform pairs. This is useful when a trans- form rule base does not contain a pair that you need. It is also useful for transforming abstract functions (i.e., saying that x[n] becomes X[z]). For example, In:= ZTransform[a^n x[n], n, z, TransformLookup -> { x[n] :> X[z] }] Out= ZTransData[ X[a z], Rminus[0], Rplus[Infinity], ZVariables[z] ] In:= ZTransform[a^n x[n], n, z, TransformLookup -> { x[n] :> { X[z], rm, rp } } ] Out= ZTransData[ X[a z], Rminus[rm], Rplus[rp], ZVariables[z] ] These transform pairs override the pairs in the transform rule bases. The multidimensional case is a natural extension: In:= ZTransform[ Upsample[l1,n1][ Upsample[l2,n2][ x[n1,n2] ] ], {n1,n2}, {z1, z2}, TransformLookup -> { x[n1,n2] :> X[z1,z2] } ] l1 l2 Out= ZTransData[ X[z1 , z2 ], Rminus[{0, 0}], Rplus[{Infinity, Infinity}], ZVariables[{z1, z2}] ] o The Rotate operator and its Fourier transform relationship have been introduced, as well as Fourier transform pairs common in the field of tomographic reconstruction. --> Filters o CFIR and CIIR structures have an optional third argument: Roots -> roots. This argument can be used in lieu of a coefficient list so that a user may specify filters in terms of their poles and zeroes. For example, CIIR[t, Roots -> {-1, -2, -3}] gives CIIR[t, {6, 11, 6, 1}]. o The time responses of analog filters can now be plotted o Computational objects for IIR structures, called IIRFunction, now exist. Also, FIR structures can be rewritten as a formula. Their values can now be plotted. Values are calculated as they are needed, and IIRFunction remembers (caches) previous calculations. --> Stability Checking o Stable will resolve stability of non-separable signals more often (e.g., Stable will return False when applied to the z-transform of (1/2)^n1 (4/5)^n2 Multinomial[n1,n2] Step[n1,n2] instead of an unresolved expression.) --> Signal Analysis o The signal analysis routines, ASPAnalyze for analog signals and DSPAnalyze for digital signals, take arguments in the same form as the plotting routines, e.g., ASPAnalyze[ Sin[t], {t, 0, Pi} ]. --> Difference/Differential Equation Solvers o ZSolve and LSolve solve difference and differential equations, respectively. They can justify their answers in the same way as the transforms do according to the level of Dialogue (see above). --> Lattice Theory o The routines supporting the rules for multirate multidimensional signal processing (i.e., lattice and integer matrix theory) have been gathered in "Multirate.m" in the Support directory, including "DistinctCosetVectors", "SmithNormalForm", and "SmithReducedForm". o Added the functions ColumnHermiteForm and RowHermiteForm as well as LCLM, LCRM, GCRD, and GCLD. o Added the number theoretic EuclidFactors to complement the routine BezoutNumbers. BezoutNumbers finds integers mu and lambda given integers a and b such that a mu + b lambda == gcd(a,b) (BezoutNumbers calls the Mathematica primitive ExtendedGCD.) EuclidFactors finds the integers mu and lambda given relatively prime integers p and q and any integer k so that p mu + q lambda == k EuclidFactors also works when p and q are integer matrices (in which case mu, lambda, and k become integer vectors). o Added UpsampledSystem and ReorderResampling to help detect resampled relationships among variables in an expression --> Changes to Mathematica Primitives o Integrate so that it can handle generalized functions like the Dirac delta (Delta) and functions with discontinuities like continuous-time step (CStep) and pulse (CPulse) functions. o Simplify applied to an And expression removes redundant conditions o Det of a number is that number o Dot product of two numbers is the product of the two numbers o The TeX forms of Re and Im primitives are Re and Im instead of R and I.