The short-time Fourier transform (STFT) is used to analyze how the frequency content of a nonstationary signal changes over time.
The STFT of a signal is calculated by sliding ananalysis windowof length
over the signal and calculating the discrete Fourier transform of the windowed data. The window hops over the original signal at intervals of
samples. Most window functions taper off at the edges to avoid spectral ringing. If a nonzero overlap length
is specified, overlap-adding the windowed segments compensates for the signal attenuation at the window edges. The DFT of each windowed segment is added to a matrix that contains the magnitude and phase for each point in time and frequency. The number of rows in the STFT matrix equals the number of DFT points, and the number of columns is given by
where
is the length of the original signal
and the⌊⌋symbols denote the floor function.
The STFT matrix is given by
such that the
th element of this matrix is
where
— Window function of length
.
— DFT of windowed data centered about time
.
— Hop size between successive DFTs. The hop size is the difference between the window length
and the overlap length
.
The magnitude squared of the STFT yields thespectrogram
representation of the power spectral density of the function.