Fast Fourier transform

Syntax: | `m = FFT(y) m = FFT(y,'AMP&PHASE') m = FFT(y,'COS&SIN')`

The `FFT` function calculates the discrete fast Fourier transform of the input variable, `y`. By default, `FFT` returns the amplitudes and the phases, where the phases are in degrees. If the `COS&SIN` keyword is used, `FFT` returns the Fourier coefficients.

Note that the reason that the amplitudes and phases are returned by default is historical. Actually, the Fourier coefficients, that is, the cosine and sine coefficients, are calculated and the amplitudes and phases are just derived from them, as described below. It is a simple matter for the user to request the cosine and sine coefficients, and then to calculate the amplitudes and phases him/herself.

Suppose that the length of the input vector is `2N`. The output of this function is a matrix with `N+1` rows and 2 columns. The first column contains the amplitudes (or the cosine coefficients), and the second column contains the phases (or the sine coefficients).

The `IFFT` function calculates the inverse fast Fourier transform.

Fourier coefficients
Discrete Fourier series
Restrictions
Prime factors
Example