This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / Standard Packages / Calculus /

Calculus`FourierTransform`

The Mathematica kernel provides the functions FourierTransform and InverseFourierTransform for computing the symbolic Fourier exponential transform and inverse transform. It also provides the functions FourierSinTransform, InverseFourierSinTransform, FourierCosTransform, and InverseFourierCosTransform for computing the symbolic Fourier sine and cosine transforms and their inverses. This package provides functions giving numerical approximations to these Fourier transforms. It also provides functions for Fourier series, Fourier coefficients, discrete-time Fourier transforms, and their numerical counterparts. The numerical approximations use Mathematica's numerical integration and summation directly without first trying for an exact solution.

Finding numerical approximations to Fourier transforms.

This loads the package.

In[1]:= <<Calculus`FourierTransform`

This gives a numerical approximation to the Fourier transform of with respect to at .

In[2]:= NFourierTransform[Exp[-t^2]/(1 + Abs[t]), t, 1]

Out[2]=

In addition to supporting the NIntegrate options, the numerical Fourier transform functions support the option FourierParameters. This option allows you to choose among the various conventions used for defining Fourier transforms.

Effect of FourierParameters setting on Fourier transform.

Effect of FourierParameters setting on Fourier sine transform.

Effect of FourierParameters setting on Fourier cosine transform.

The Fourier transform is commonly used to transform a problem from the continuous "time domain" into the continuous "frequency domain." The Fourier transform may be viewed as the continuous analog of the Fourier series decomposition, which expresses a periodic function as a superposition of exponential or trigonometric functions. Fourier exponential and trigonometric series decompositions may be computed using the functions FourierSeries and FourierTrigSeries. The coefficients of the exponential series are found using FourierCoefficient and the coefficients of the trigonometric series are found using FourierSinCoefficient and FourierCosCoefficient. If the option setting FourierParameters -> a, b is specified, the continuous function of is treated as having a period of , instead of the default period of .

Computing Fourier coefficients and series.

Here is a plot of the difference between and the integer closest to . It is a periodic function with fundamental interval from to .

In[3]:= rndplt = Plot[t - Round[t], {t, -1.5, 1.5}]

Out[3]=

This gives a piece of the Fourier trigonometric series of the difference function. The difference function is odd so its trigonometric series contains only sines.

In[4]:= FourierTrigSeries[t, t, 3]

Out[4]=

The plot of the truncated series is similar to that of the function.

In[5]:= Plot[%, {t, -1.5, 1.5}]

Out[5]=

Here are the two plots on the same axes.

In[6]:= Show[rndplt, %]

Out[6]=

Effect of FourierParameters setting on Fourier exponential coefficients.

Effect of FourierParameters setting on Fourier exponential series.

Effect of FourierParameters setting on Fourier cosine coefficients.

Effect of FourierParameters setting on Fourier sine coefficients.

Effect of FourierParameters setting on Fourier trigonometric series.

In certain circumstances you will not want exact or symbolic coefficients, but numerical approximations to the coefficients. In these cases you can use the numerical versions of the Fourier series functions. The numerical approximation functions accept the FourierParameters option, allowing you to specify the period.

Finding approximate numerical values for Fourier coefficients and series.

Here is a piece of the trigonometric series of a function that looks like on the interval from to . The function elsewhere is obtained by repeating this with period .

In[7]:= NFourierTrigSeries[Sin[Cos[t + 1/2]], t, 3]

Out[7]=

Here is a plot of the trigonometric polynomial over three periods.

In[8]:= Plot[%, {t, -1.5, 1.5}]

Out[8]=

The function FourierCoefficient, giving the coefficients of the Fourier exponential series, can be thought of as a transform from the continuous time domain into the discrete frequency domain. Likewise, the (infinite sum) Fourier exponential series can be thought of as an inverse transform from the discrete frequency domain into the continuous time domain. This transform pair is given by FourierCoefficient and InverseFourierCoefficient, and the numerical counterparts are given by NFourierCoefficient and NInverseFourierCoefficient. If the option setting FourierParameters -> a, b is specified, the period of the original function is taken to be , instead of the default period of .

Continuous-time and discrete-frequency transform pairs: exact and numerical approximations.

Here is a plot of a periodic function of , with a period of .

In[9]:= (f = 1 + 2 Cos[3 Pi t] + 2 Cos[6 Pi t];
Plot[f, {t, -1, 1}])

Out[9]=

You can use the FourierParameters option to specify the period of the function.

In[10]:= Chop[Table[
NFourierCoefficient[f, t, n,
FourierParameters -> {0, 3/2},
AccuracyGoal->8, PrecisionGoal->8],
{n, -10, 10}]]

Out[10]=

The inverse of the Fourier coefficients gives the original periodic function.

In[11]:= (nifc = Chop[Table[
{t, NInverseFourierCoefficient[If[-2 <= n <= 2, 0.816497, 0],
n, t, FourierParameters -> {0, 3/2}]},
{t, -1, 1, 1/30}]];
ListPlot[nifc, PlotJoined->True])

Out[11]=

Effect of FourierParameters setting on Fourier coefficient.

The Fourier transform from the discrete time domain into the continuous frequency domain is usually termed the discrete-time Fourier transform, or DTFourierTransform. The inverse transform from the continuous frequency domain into the discrete time domain is given by InverseDTFourierTransform. Just as the Z transform is the discrete analog of the Laplace transform, the discrete-time Fourier transform is the discrete analog of the continuous-time Fourier transform. If the option setting FourierParameters -> a, b is specified, the period of the discrete-time Fourier transform is taken to be , instead of the default period of .

Discrete-time and continuous-frequency transform pairs: exact and numerical approximations.

This computes the Fourier transform of a discrete-time rectangular function centered at .

In[12]:= dtft = DTFourierTransform[
Sum[DiscreteDelta[n+j], {j, -1, 1}],
n, Omega]

Out[12]=

Here is a plot of the amplitude spectrum over three periods.

In[13]:= Plot[Abs[dtft], {Omega, -1.5, 1.5}]

Out[13]=

Here is a numerical approximation to the inverse discrete-time Fourier transform, for .

In[14]:= Chop[Table[
NInverseDTFourierTransform[dtft, Omega, n,
AccuracyGoal->8, PrecisionGoal->8],
{n, -5, 5}]]

Out[14]=

The Fourier exponential series and discrete-time Fourier transforms are mathematically equivalent, if one exchanges the roles of time and frequency.

Effect of FourierParameters setting on discrete-time Fourier transform.