fft

fft(x)

Try it yourself:

See also:

Analyze frequency content with fft

fft(x) computes the fast Fourier transform of a sequence. It converts samples from a time or index domain into complex frequency coefficients, revealing periodic components efficiently.

Reading a transform

A strong coefficient indicates energy near its corresponding frequency. The output is generally complex, so use abs for magnitude and arg for phase. ifft reverses the transform and should reconstruct the original sequence up to rounding error.

Practical preparation

Sample spacing determines the physical frequency scale; fft alone does not know whether samples are seconds, milliseconds, or pixels. Remove a large offset when it obscures smaller oscillations, and use mean to find that offset. For filter frequency response rather than a transform of samples, see freqz.

Caveats

Finite records can cause spectral leakage, and the highest measurable frequency is limited by sampling rate. Complex output and ordering conventions matter when interpreting bins. Use matching sequence lengths and do not mistake the transform magnitude for an automatically normalized amplitude.

All functions