Skip to main content

Creating a composite signal

Build a signal by summing sine waves at different frequencies. This is the starting point for most frequency-domain analysis.

Computing the FFT and finding frequency components

The FFT converts a time-domain signal into its frequency-domain representation, revealing which frequencies are present.

Filtering frequencies and inverse FFT

Remove unwanted frequencies by zeroing out their components in the frequency domain, then transform back to the time domain.

Using fftfreq and fftshift

fftfreq returns the frequency bins for each FFT output element. fftshift rearranges the output so that the zero-frequency component is at the center, which is the standard convention for visualization.

Convolution with a kernel

Convolution is fundamental to signal processing — it is used for smoothing, differentiation, edge detection, and more. numpy-ts provides convolve for 1-D convolution.
The 'same' mode returns output with the same length as the input, 'full' returns the full convolution (length M+N-1), and 'valid' returns only the part computed without zero-padded edges.

Real FFT for real-valued signals

When your input is purely real (no imaginary component), rfft is more efficient than fft because it exploits the conjugate symmetry of the spectrum.