|MATLAB Function Reference|
Discrete Fourier transform
ifft(X) implement the transform and inverse transform pair given for vectors of length by:
is an th root of unity.
Y = fft(X)
returns the discrete Fourier transform (DFT) of vector
X, computed with a fast Fourier transform (FFT) algorithm.
X is a matrix,
fft returns the Fourier transform of each column of the matrix.
X is a multidimensional array,
fft operates on the first nonsingleton dimension.
Y = fft(X,n)
n-point DFT. If the length of
X is less than
X is padded with trailing zeros to length
n. If the length of
X is greater than
n, the sequence
X is truncated. When
X is a matrix, the length of the columns are adjusted in the same manner.
applies the FFT operation across the dimension
Y = fft(X,,dim) and
Y = fft(X,n,dim)
A common use of Fourier transforms is to find the frequency components of a signal buried in a noisy time domain signal. Consider data sampled at 1000 Hz. Form a signal containing 50 Hz and 120 Hz and corrupt it with some zero-mean random noise:
It is difficult to identify the frequency components by looking at the original signal. Converting to the frequency domain, the discrete Fourier transform of the noisy signal
y is found by taking the 512-point fast Fourier transform (FFT):
The power spectrum, a measurement of the power at various frequencies, is
Graph the first 257 points (the other 255 points are redundant) on a meaningful frequency axis:
This represents the frequency content of
y in the range from DC up to and including the Nyquist frequency. (The signal produces the strong peaks.)
The FFT functions (
ifftn) are based on a library called FFTW ,. To compute an -point DFT when is composite (that is, when ), the FFTW library decomposes the problem using the Cooley-Tukey algorithm , which first computes transforms of size , and then computes transforms of size . The decomposition is applied recursively to both the - and -point DFTs until the problem can be solved using one of several machine-generated fixed-size "codelets." The codelets in turn use several algorithms in combination, including a variation of Cooley-Tukey , a prime factor algorithm , and a split-radix algorithm . The particular factorization of is chosen heuristically.
When is a prime number, the FFTW library first decomposes an -point problem into three ()-point problems using Rader's algorithm . It then uses the Cooley-Tukey decomposition described above to compute the ()-point DFTs.
For most , real-input DFTs require roughly half the computation time of complex-input DFTs. However, when has large prime factors, there is little or no speed difference.
The execution time for
fft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors.
freqz in the Signal Processing Toolbox
 Cooley, J. W. and J. W. Tukey, "An Algorithm for the Machine Computation of the Complex Fourier Series," Mathematics of Computation, Vol. 19, April 1965, pp. 297-301.
 Duhamel, P. and M. Vetterli, "Fast Fourier Transforms: A Tutorial Review and a State of the Art," Signal Processing, Vol. 19, April 1990, pp. 259-299.
 FFTW (http://www.fftw.org)
 Frigo, M. and S. G. Johnson, "FFTW: An Adaptive Software Architecture for the FFT," Proceedings of the International Conference on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.
 Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal Processing, Prentice-Hall, 1989, p. 611.
 Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal Processing, Prentice-Hall, 1989, p. 619.
 Rader, C. M., "Discrete Fourier Transforms when the Number of Data Samples Is Prime," Proceedings of the IEEE, Vol. 56, June 1968, pp. 1107-1108.