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

Documentation / Mathematica / The Mathematica Book / Advanced Mathematics in Mathematica / Numerical Operations on Data /

3.8.4 Fourier Transforms

A common operation in analyzing various kinds of data is to find the Fourier transform, or spectrum, of a list of values. The idea is typically to pick out components of the data with particular frequencies, or ranges of frequencies.

Fourier transforms.

Here is some data, corresponding to a square pulse.

In[1]:= {-1, -1, -1, -1, 1, 1, 1, 1}

Out[1]=

Here is the Fourier transform of the data. It involves complex numbers.

In[2]:= Fourier[%]

Out[2]=

Here is the inverse Fourier transform.

In[3]:= InverseFourier[%]

Out[3]=

Fourier works whether or not your list of data has a length which is a power of two.

In[4]:= Fourier[{1, -1, 1}]

Out[4]=

This generates a length-200 list containing a periodic signal with random noise added.

In[5]:= data = Table[ N[Sin[30 2 Pi n/200] + (Random[ ] - 1/2)],
{n, 200} ] ;

The data looks fairly random if you plot it directly.

In[6]:= ListPlot[ data, PlotJoined -> True ]

Out[6]=

The Fourier transform, however, shows a strong peak at , and a symmetric peak at , reflecting the frequency component of the original signal near .

In[7]:= ListPlot[ Abs[Fourier[data]], PlotJoined -> True,
PlotRange -> All ]

Out[7]=

In Mathematica, the discrete Fourier transform of a list of length is by default defined to be . Notice that the zero frequency term appears at position 1 in the resulting list.

The inverse discrete Fourier transform of a list of length is by default defined to be .

In different scientific and technical fields different conventions are often used for defining discrete Fourier transforms. The option FourierParameters in Mathematica allows you to choose any of these conventions you want.

Typical settings for FourierParameters with various conventions.

Two-dimensional Fourier transform.

Mathematica can find Fourier transforms for data in any number of dimensions. In dimensions, the data is specified by a list nested levels deep. Two-dimensional Fourier transforms are often used in image processing.