Skip to content

fft

1D Fast Fourier Transform.

Y = fft(X)
Y = fft(X, n)
Y = fft(X, n, dim)

Returns the discrete Fourier transform of X along the first non-singleton dimension. With n, zero-pads or truncates X to length n first. With dim, transforms along that dimension. Uses an optimized FFT (radix-2 + mixed-radix) on power-of-two and other composite lengths.

% Spectrum of a sine wave
t = 0:0.001:1; x = sin(2*pi*50*t);
Y = fft(x);
P = abs(Y).^2; % power spectrum
  • fft2 — 2D Fast Fourier Transform.
  • fftn — N-dimensional Fast Fourier Transform.
  • filter — 1D digital filter (IIR / FIR).
  • conv — Discrete convolution.