FFT, windows, STFT, Welch PSD, and periodogram — mirrors numpy.fft
and scipy.signal.
Edit any code block below and press ▶ Run
(or Ctrl+Enter) to execute it live in your browser.
Compute a 32 Hz sine wave's FFT and identify the peak frequency bin.
The total energy is preserved between time and frequency domains.
Real-input FFT produces a half-spectrum; irfft reconstructs the original signal.
Named windows reduce spectral leakage. Use getWindow(name, n) to obtain any built-in window.
Analyze a chirp signal whose frequency increases linearly over time.
Invert an STFT back to the time domain. Interior reconstruction error should be near machine epsilon.
Welch's method averages periodograms of overlapping segments for a lower-variance PSD estimate.
A single-segment PSD estimate — higher variance but simpler than Welch.
Rearrange the FFT output so that the zero-frequency component is in the centre.
| Function | Description | Mirrors |
|---|---|---|
fft(x) | N-point DFT (pads to power of 2) | numpy.fft.fft |
ifft(X) | Inverse FFT | numpy.fft.ifft |
rfft(x) | Real-input FFT (one-sided) | numpy.fft.rfft |
irfft(X, n?) | Inverse real FFT | numpy.fft.irfft |
fftFreq(n, d?) | DFT sample frequencies | numpy.fft.fftfreq |
rfftFreq(n, d?) | One-sided DFT frequencies | numpy.fft.rfftfreq |
fftshift(x) | Shift DC to centre | numpy.fft.fftshift |
ifftshift(x) | Inverse of fftshift | numpy.fft.ifftshift |
getWindow(name, n) | Named window function | scipy.signal.get_window |
stft(x, opts?) | Short-Time Fourier Transform | scipy.signal.stft |
istft(Zxx, opts?) | Inverse STFT (overlap-add) | scipy.signal.istft |
welch(x, opts?) | Welch PSD estimate | scipy.signal.welch |
periodogram(x, opts?) | Periodogram PSD estimate | scipy.signal.periodogram |