Spectrogram (source code)

= Spectrogram
{wiki}

A <spectrogram> displays a signal's changing local <frequency spectrum>, usually by color proportional to squared <short-time Fourier transform> magnitude. With <window function> $w$, one convention is
$$
V_wf(t,\omega)=\int_{\mathbb R}f(s)\overline{w(s-t)}e^{-i\omega s}\,ds,\qquad P(t,\omega)=|V_wf(t,\omega)|^2.
$$
The window selects a neighborhood of time $t$ before taking its <Fourier transform>. A <sinusoid> gives a persistent frequency ridge, while a brief pulse spreads across frequencies and occupies a short time range.

A longer window separates nearby persistent frequencies more clearly but mixes events across a longer interval. A shorter window localizes transients but broadens their spectral features. Changing the <window function> changes this tradeoff and the <spectral leakage>. Zero padding can sample the displayed frequency curve more finely; it does not add observed data or restore the resolution lost through a short measurement interval. The phase is discarded in the plotted squared magnitude, so the spectrogram should not be confused with a complete set of complex transform coefficients.