Mathematica 9 is now available

 Documentation /  Signals and Systems /

An Optimal FilterCepstral Analysis

5 Mathematical Transforms

Signals and Systems implements a variety of standard mathematical linear transforms frequently used in signal processing. While many of these transforms are also implemented in the standard Mathematica, there are several differences. For instance, the standard routines do not handle as wide a variety of functions specific to signal processing. Another difference is that Signals and Systems allows the use of bilateral, left-sided, or right-sided transforms (in which the range of integration or summation runs from -Infinity to Infinity, -Infinity to 0, or 0 to Infinity, respectively), while for Laplace transforms, Mathematica implements only the right-sided variant. These modifications improve the utility of the transforms for signal processing applications. Other advantages of the transforms as implemented in this application include the ability to track regions of convergence for Laplace and Z transforms, an option allowing you to specify abstract transform pairs, and the implementation of some nonseparable multidimensional transforms.

All of the transforms in Signals and Systems perform symbolic computation, including the discrete Fourier transform. This allows transforms to be performed on signals expressed symbolically, rather than as explicitly specified sequences of data.

5.1 Transforms of Continuous Signals

The Laplace Transform

The Laplace transform is a staple operation from the analysis of continuous systems. The transform and its inverse are used primarily in transient analysis. At its core, Signals and Systems uses the standard definition given in many texts.

The region of convergence is a strip in the s plane. Signals and Systems provides the convergence information to the user by placing the result in a special data type. The inverse transform is defined as

(The constant is appropriately chosen based on convergence of the integrand.)

The actual algorithm used by the application involves a combination of table lookup and rules based on transform properties. You can specify that the standard Mathematica integration routines be attempted as well, based on the preceding definition. For more details on the algorithm, see, for instance, Evans (1992).

The Laplace transform and its inverse.

The Laplace transform uses the same syntax as the standard Mathematica function LaplaceTransform. It has several extensions, however. One modification is a nonevaluating operator form for use in manipulation of systems. All of the transforms provided with Signals and Systems have this alternate syntax.

First, make the signal processing functions available.


Here is a basic Laplace transform.

In[2]:=LaplaceTransform[Exp[-Abs[t]], t, s]


Another major difference between the standard Mathematica version and the version here is immediately apparent. Now, LaplaceTransform returns by default the special data type LaplaceTransformData. This data type includes information on the region of convergence and the variables involved in the transformation, which is particularly useful in stability analysis.

Here is an example of a two-dimensional transform. This function is nonseparable, and represents an impulse of changing magnitude along the line , where and are greater than zero.

Exp[a t1] *
DiracDelta[t1 - t2] UnitStep[{t1, t2}],
{t1, t2}, {s1, s2}


Like the forward transform, the inverse transforms have rule bases that implement many properties of the transform.

Here is the inverse transform of a rational function.

In[4]:=InverseLaplaceTransform[s/(1 + s^2), s, t]


The rule base knows that multiplication of the function by an exponential term is equivalent to a shift of the inverse transform.

Exp[-a s] s / ( 1 + s^2 ),
s, t


Options for LaplaceTransform.

A variety of options can be employed to enhance the behavior of LaplaceTransform. The option named TransformDirection specifies whether the transform is to be bilateral (TwoSided), right-sided (RightSided), or left-sided (LeftSided). By default, it is set to $TransformDirection, which is set to TwoSided. By changing the current value of $TransformDirection, you can set this characteristic for all of the transform functions simultaneously.

A left-sided transform is equivalent to the bilateral transform of the function multiplied by a UnitStep running in the negative direction.

In[6]:=LaplaceTransform[Exp[-Abs[t]], t, s,
TransformDirection -> LeftSided]


The Justification option can be employed to display the steps involved in performing the transform. It takes the values All, Automatic, or None, where All provides all information available, Automatic provides only the most useful information, and None provides no additional information about the procedure.

Here is a transform displaying the procedures used in the computation.

In[7]:=LaplaceTransform[Exp[-Abs[t]], t, s,
Justification -> All]


By allowing you to specify your own transform pairs, the TransformPairs option lets you extend the transform rule bases for unknown functions. These may be functions that have not been entered into the rule base, or may be abstract transform pairs specific to a particular computation. The option accepts a list of RuleDelayed transformations giving the target function and its transform. Region of convergence information can be given by writing the rule's target in the form of a list, . Note that the target function must be in the same variable as the entire expression being transformed, while the transform of the target must be in terms of the transform variable.

LaplaceTransform does not know how to handle the Sign function by default, but a user-defined rule can be specified to perform the transformation. Note that standard properties (e.g., shift, scaling) are handled automatically.

Sign[3 t - 2] + UnitStep[t] Cos[omega t],
t, s, TransformPairs -> {Sign[t] :> 2/s}


Many transforms cannot be determined in closed form, but for transforms of continuous functions, we can compute an approximation based on the series expansion of the function. The SeriesTerms option specifies the number of terms to use in the expansion. If it is set to None, the series expansion will not be attempted.

Here, a transform is attempted without performing a series expansion. The attempt fails; there are no rules for this function in the rule base.

In[9]:=LaplaceTransform[Tan[t], t, s,
SeriesTerms -> None


This tries expanding the function to eight terms before giving up. In this case, the series expansion was successful, and an approximation to the transform could be returned.

In[10]:=LaplaceTransform[Tan[t], t, s,
SeriesTerms -> 8


The StandardFormula option allows the transform function to attempt to directly perform the integral if the transform cannot be found by use of the rule bases. It takes the values True or False, indicating whether or not to attempt the integral if necessary.

The transform of this function is not known by the transform rule base, although a series approximation can be generated. The series representation is not useful to us in this example, so we suppress it via the SeriesTerms option.

Sin[x] ContinuousPulse[3, x],
x, s,
SeriesTerms -> None


However, Mathematica can directly integrate this transform. Because the StandardFormula option is applied before the SeriesTerms option, we don't need to suppress the series expansion.

Sin[x] ContinuousPulse[3, x],
x, s,
StandardFormula -> True


Also available is the SimplifyOutput option, which indicates whether automatic simplification will be attempted during the computation. Simplification of algebraic expressions is a computationally intensive task, but it can in some cases significantly improve the form of output. Note that simplification is performed by the SimplifySignal function, which may not result in a smaller leaf count, but should result in an expression that is easier to manipulate. The SimplifyOutput option can take the values None, Automatic, or All. If set to All, the simplification will assume that symbols that must be real-valued for the transform to complete are real-valued for simplification purposes; this is slower but less thorough than the setting Automatic, which does not make that assumption. If set to None, no simplification will be attempted.

Option specific to the inverse Laplace transform.

The inverse Laplace transform has one option not available for the forward transform. The option called DecompositionPrecision controls the behavior of partial fraction decomposition in the inverse transform. When partial fraction decomposition must be used to determine the transform, an exact technique is usually employed to find the roots of the denominator. However, for polynomials of higher order, this may be infeasible. Setting this option to an integer precision less than Infinity allows a purely numeric technique to be employed. (For quick computation, it is usually best to set it to $MachinePrecision; in some cases, higher precision may be useful.) The resulting transform will not be as precise, but it will still be useful. If the strategy of partial fraction composition should not be attempted, set DecompositionPrecision to None.

Here is a transform performed with the (default) exact partial fraction decomposition.

(s + 3)/(s^2 + 2 s + 3), s, t,
DecompositionPrecision -> Infinity


The transform can be performed much more quickly by specifying a finite precision, but at the cost of returning numeric output.

(s + 3)/(s^2 + 2 s + 3), s, t,
DecompositionPrecision -> $MachinePrecision


You can disable the attempt at partial fraction decomposition. In this case, other rules take over to compute the transform.

(s + 3)/(s^2 + 2 s + 3), s, t,
DecompositionPrecision -> None


The Fourier Transform

The Fourier transform can sometimes be considered a special case of the Laplace transform, evaluated where the real part of the transform variable s is zero. It is often used for frequency analysis of signals. Signals and Systems uses the standard definition

The inverse transform is defined as

Note that the nonsymmetric form is used, which parallels the Laplace transform. The actual algorithm depends on table lookup and transformation rules that apply the properties of the transform. The Fourier transform applies to continuous signals. The discrete equivalents are the discrete-time Fourier transform and the discrete Fourier transform, documented in the next section.

The Fourier transform and its inverse.

Here is a Fourier transform.

Cos[t] Exp[-t] UnitStep[t],
t, w


Here is a plot of the transformed result.

In[17]:=SignalPlot[%, {w, -2, 2}]


As with LaplaceTransform, a special data type is returned, identifying the transform used in the computation. FourierTransform accepts all of the options of LaplaceTransform and attaches the same meaning to them.

Here is a transform using the TransformDirection option. This performs a left-sided transform (from -Infinity to 0).

t, w,
TransformDirection -> LeftSided


A rectangular pulse centered on the origin is separable, and easily transformed in any number of dimensions.

ContinuousPulse[{1, 1, 1},
{t1 + 1/2, t2 + 1/2, t3 + 1/2}],
{t1, t2, t3},{w1, w2, w3}


The inverse transform employs all of the same options as the forward transform. It is used in much the same way as the forward transform, but does not return a special data type.

This symbolic inverse Fourier transform demonstrates that the rule base "knows" the modulation theorem, which in this case causes the transform of the modulated signal to be a pulse of width a centered at zero.

1/2 (ContinuousPulse[a, w + a/2 - w0] +
ContinuousPulse[a, w + a/2 + w0]),
w, t


Here is an inverse transform that cannot be performed in closed form. However, a series approximation can be made to give us an inexact result in terms of derivatives of Dirac delta functions.

w, t,
SeriesTerms -> 8


5.2 Transforms of Discrete Signals

The Z Transform

The Z transform is essentially the discrete equivalent of the Laplace transform. It produces a continuous function from a sequence via the following formula

The region of convergence is an annulus (whose interior radius can be zero and exterior radius infinite). The inverse transform is

where is a counterclockwise contour encircling the origin. As with the continuous transforms, Signals and Systems primarily uses table lookup and application of the properties of the transform to perform the computation.

The Z transform and its inverse.

The syntax of the discrete transforms is essentially like that of the continuous transforms and the transforms that come with Mathematica. Like the continuous transforms provided with Signals and Systems, a nonevaluating operator form of the transform is provided for manipulation of cascaded systems.

This is the Z transform of the sum of two exponentials.

((1/2)^n + (-1/3)^n) DiscreteStep[n],
n, z


We can visualize the poles, zeros, and region of convergence of a rational transform.



Options for ZTransform.

The Z transform has most of the options of the Laplace transform. The TransformDirection option controls whether the transform is left-sided, right-sided, or bilateral. The Justification option causes information about the steps taken in the transform to be printed when set to Automatic or All. TransformPairs allows user-specified transformation rules to be given to supplement the built-in rule base. If the rule base fails to compute the transform, the option StandardFormula allows the transform function to attempt to use the defintion given by the summation. SimplifyOutput allows additional simplification of the results to be attempted automatically. It can be set to None to reduce computation time on examples where additional simplification is unlikely to be useful.

The TransformPairs option can be used to specify abstract transformations, as in the transformation of this system equation, where x[n] is the input signal and y[n] is the output signal. Note that Normal is wrapped around the transform to extract the equation from the transform data type for easy manipulation.

y[n] == x[n] - (1/4) y[n - 2],
n, z,
TransformPairs -> {y[n] :> Y[z], x[n] :> X[z]}


The system transfer function can be determined by solving the above system for Y[z] and dividing by X[z].

In[25]:=(Y[z]/.First[Solve[%, Y[z]]])/X[z]


Taking the inverse transform of the system transfer function gives us the impulse response.

In[26]:=InverseZTransform[%, z, n]


This is the impulse response of the system we are working with.

In[27]:=DiscreteSignalPlot[%, {n, -5, 15}]


Without region of convergence information, a Z transform is not unique. If you wish to perform an inverse transform that requires specification of the region of convergence, you must enter the transform object directly.

Here is a multidimensional separable Z transform. Note the region of convergence.

a^n1 b^n2 DiscreteStep[{n1, n2}],
{n1, n2}, {z1, z2}


Here is an inverse transform where we take the function that results from the previous computation, but change the region of convergence. Note how the result varies compared to the input to the preceding example.

{0, Abs[b]},
{Abs[a], Infinity}
TransformVariables[{z1, z2}]
{z1, z2}, {n1, n2}


Options for inverse Z transform.

Since the inverse Z transform is transforming a continuous function, it accepts the SeriesTerms option. This will attempt a series expansion of the function to be transformed to a specified number of terms if no transform can be found. Note that SeriesTerms can also be set to None, indicating that the method is not to be attempted. The inverse Z transform also employs the DecompositionPrecision option. For exact decomposition, the option should be set to Infinity.

Here is an inverse Z transform performed by the SeriesTerms option. The result is only an approximation to what the actual transform would be. Expand is used here to arrange the terms in a more attractive form.

BesselJ[1, z],
z, n,
SeriesTerms -> 8


The StandardFormula option is not available for inverse Z transforms, as standard integration technology is not able to handle most of the contour integrals from transforms that cannot be computed by the standard Z transform rule base.

The Discrete-Time Fourier Transform

The discrete-time Fourier transform is related to the Z transform, and can under certain circumstances be viewed as a special case of the Z transform, with convergence inside the unit circle. Like the Z transform, it accepts a discrete function as input and returns a continuous function. The standard formula is

and for the inverse transform

Because of the similarities between this transform and the Z transform, the implementation in Signals and Systems simply adds rules for those cases where the discrete-time Fourier transform is different, then call the Z transform with the appropriate variable substitution for all other cases.

The discrete-time Fourier transform and its inverse.

The syntax of the discrete-time Fourier transform is much like that of the Z transform.

All the transform functions, including the discrete-time Fourier transform, accept symbolic input.

a^n DiscreteStep[n - 4],
n, w


This is the two-dimensional discrete-time Fourier transform of a particular pattern of samples around the origin.

(1/6) DiscreteImpulse[n1 - 1, n2 - 1] +
(1/6) DiscreteImpulse[n1 + 1, n2 - 1] +
(1/6) DiscreteImpulse[n1 - 1, n2 + 1] +
(1/6) DiscreteImpulse[n1 + 1, n2 + 1] +
(1/3) DiscreteImpulse[n1, n2],
{n1, n2}, {w1, w2}


This is the magnitude of the transform, plotted. Note that to perform mathematical computations with a transform result, it must be extracted from the data structure that the transform returns.

{w1, -Pi, Pi}, {w2, -Pi, Pi}


DiscreteTimeFourierTransform accepts the same options as ZTransform, with the same meanings. Similarly, the inverse transform uses the same options as the inverse Z transform.

Here is a simple example of an abstract transform pair. Note that the TransformPairs option will only be effective if the standard properties of the transform can be applied to simplify the input to the point that the user-specified transform pair can be applied.

x[n + 3],
n, w, TransformPairs -> {x[n] :> X[w]}


The inverse transform can also make use of the TransformPairs option.

w, n,
TransformPairs -> {X[w] :> x[n]}


The Discrete Fourier Transform

Given a finite sequence of length , the Fourier transform can be represented by uniformly distributed samples of the discrete-time Fourier transform. This is known as a discrete Fourier transform.

The inverse transform is written as

Unlike the built-in Mathematica function Fourier which computes numeric discrete Fourier transforms, the Signals and Systems function DiscreteFourierTransform computes symbolic transforms.

The discrete Fourier transform and its inverse.

Because of the symbolic nature of the discrete Fourier transform as implemented in Signals and Systems, you can specify a formula and the number of samples N over which the transform is to be applied. The sequence to be transformed is assumed to run from to . The result of the transform is periodic; this is emphasized by use of the Periodic operator in the returned data object.

Here is a simple transform demonstrating the symbolic aspects of the DiscreteFourierTransform function. Here, the sequence has a length of .

In[36]:=DiscreteFourierTransform[Sin[n], 10, n, k]


An inverse transform is computed in a similar fashion.

In[37]:=InverseDiscreteFourierTransform[Sin[k], 10, k, n]


Options for DiscreteFourierTransform and InverseDiscreteFourierTransform.

The DiscreteFourierTransform and its inverse use some of the Z and inverse Z transform options. They take essentially the same meanings, but since the selection of applicable options is different, they are listed again here. Note in particular that the TransformDirection option is not applicable to the discrete Fourier transform, nor is the SeriesTerms option.

When Justification is set to Automatic, not as much additional information is generated. This tells us that the transform is computed by way of the discrete-time Fourier transform.

{h[0], h[1], h[2], h[3], h[4]},
5, n, w,
Justification -> Automatic


Special syntax for transforming a numeric vector.

For convenience, the forward and inverse discrete Fourier transforms have a syntax that allows a numeric vector to be passed directly to the transform function, generating a vector output. The behavior is similar to that of the built-in function Fourier, but with the definition of the discrete Fourier transform used in Signals and Systems. The usual options are not available with this syntax, and the symbolic techniques are not used. The same degree of rigor used by the primary algorithm is also not employed, as the output is presented simply as a vector rather than a periodic signal. However, for certain computations (such as filter design), it is sometimes useful to refer to a vector of data that is implicitly assumed to start at 0, with the output implicitly assumed to be periodic (assumptions made explicit when using SampledData objects). The input must be numeric when this syntax is employed.

Here is a numeric transform of a vector of data.

Table[2^(-n), {n, 0, 10}]//N


This inverse transform might represent the impulse response of a sampled ideal filter frequency response.

{1, 1, 1, 1, 0, 0, 0, 0}//N


5.3 Information from Transforms

Each returned transform object contains a variety of useful components. In addition, other functions can extract information such as the stability of a transform from the object.


For the Laplace and Z transforms, the stability of the signal or system under consideration can be derived from the region of convergence of the transform. In the case of the Z transform, the system is stable only if the unit circle is included in the region of convergence, while for the Laplace transform, the imaginary axis must be in the region of convergence.

Determining stability from a transform object.

The SignalStability function examines the region of convergence information in a transform data object for the stability criteria described above. If the stability can definitely be determined, the function returns True or False. If the convergence criteria include abstract parameters, SignalStability returns the conditions that those parameters must meet for the signal to be stable. The conditions are returned in the form of a logical conjunction.

Here is a Z transform.

(1/5)^n Exp[n]/20 DiscreteStep[n],
n, z


From the region of convergence, we conclude that this is stable.



This multidimensional transform from earlier in the chapter is stable when the conditions returned in this example are met.

-a^n1 b^n2 DiscreteStep[{-n1 - 1, n2}],
{n1, n2}, {z1, z2}



Some transforms can only be performed if certain conditions are met on parameters or variables involved in the transform. Signals and Systems currently maintains this information as part of the command history, via the function TransformAssumptions.

Assumptions made by transforms during a computation.

During a computation, the transform functions associate any required assumptions with a history mechanism kept in TransformAssumptions of the current value of $Line. You can retrieve the assumptions by calling TransformAssumptions with the input line you want to find out about. (If a negative value is given, TransformAssumptions will count backwards from the current line.) If True is returned, the assumptions are met by current criteria placed on parameters, or no assumptions were necessary. Otherwise, the assumptions will be returned in the form of a logical conjunction.

Here is a Laplace transform.

ExpIntegralEi[n t] UnitStep[t],
t, s


This retrieves the assumptions made during the previous input.



This syntax allows a more familiar notation to be used. Note, however, that the %% is not actually evaluated; instead, the -2 is retrieved from the Out[-2] which %% represents.



Transform Object Parts

The forward transforms return a data object that contains important information about the transform, such as the region of convergence. The most important information (the function that results from the transformation) is quite visible to the user, but, for programmatic manipulation, it is best to extract the parts of the data object using special functions. This is because the data type is subject to change, as additional information about the transform is retained.

Functions for extracting parts of transform objects.

As per the usual Mathematica convention for converting data objects, Normal can also be used to extract the function resulting from the transform.

Here is a Laplace transform.

In[47]:=trans = LaplaceTransform[
Exp[t] UnitStep[t],
t, s


This is the function resulting from the transform.



Laplace and Z transforms retain information about the region of convergence of the transform in the transform variable. It is not necessary that this information be retained for the other provided transforms. The upper and lower bounds represent different things for each of these tranforms. For the Laplace transform, the region of convergence is a strip in the complex plane bounded by constant real numbers. The upper and lower bounds are these real values. The Z transform, on the other hand, converges in an annulus in the complex plane, and the upper and lower bounds represent the absolute value of the points on the boundary. In the multidimensional case, these take the form .

The region of convergence is extracted in a similar fashion. The lower bounds are in the first argument, while upper bounds are in the second argument.



Now we extract the variables that the function was transformed to. This is necessary to distinguish variables from parameters in the transform object.



Data objects resulting from forward transforms.

Because the contents of a transform data object are in principle not fixed, it is better to access the parts of such an object by the functions listed previously, not by using Part and depending on the components to be in particular locations.

5.4 Solving Differential and Recurrence Equations

Mathematical transforms play a wide variety of roles in signal processing. For instance, they can be used to solve differential and recurrence equations. As a demonstration of this utility, Signals and Systems includes the functions LaplaceDSolve and ZRSolve. They can solve linear constant coefficient differential and recurrence equations, respectively.

These equations can also be handled by the standard Mathematica functions DSolve and RSolve. However, the standard functions employ a variety of techniques. If you specifically want to apply a transform technique, then these supplementary functions provided by Signals and Systems can be useful. LaplaceDSolve and ZRSolve also make use of the bilateral transforms, which allows a broader range of solutions than the traditional right-sided transforms permit.

The transform-based equation solvers.

The syntax of these equation solvers mimics the standard DSolve and RSolve notations. The main differences are in the class of equations that can be solved and in the allowed boundary conditions. The equations are limited to linear constant coefficient terms, with only the driving term allowed to be dependent on the variable (that is, the equation can be nonhomogenous). Systems of equations cannot currently be handled.

If initial conditions are not given, they are assumed to be zero for ZRSolve. LaplaceDSolve assumes that they are symbolic constants C[1], C[2], and so on, with constant C[n] corresponding to the derivative of order of the function at .

Here is the solution to a second-order difference equation, with an initial point specified.

{y[n-2] + 1/2 y[n-1] + 1/4 y[n] == 0,
y[1] == 1},
y[n], n


Here is a second-order differential equation. Initial values for the function are specified.

{y''[t] + 3/2 y'[t] + 1/2 y[t] ==
Exp[a t] UnitStep[t],
y[0] == 4, y'[0] == 0},
y[t], t


Options for the solving functions.

The use of the bilateral transform allows both causal and anticausal sequences to be handled by ZRSolve. The TransformDirection option can be specified with either solver; it is passed along to the corresponding transform function.

The Justification option is much like that used elsewhere. When set to None, no additional information is provided; when Automatic, some information about the steps taken is printed; and when All, detailed output is given.

Here is a difference equation solved with the Justification option activated. More information can be generated by setting the option to All.

{y[n-2] + 1/2 y[n-1] + 1/4 y[n] == 0,
y[0] == 1, y[1] == 0},
y[n], n, Justification -> Automatic


An Optimal FilterCepstral Analysis

Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information