|Download Help (Windows Only)|
The discrete Fourier transform expresses a signal as a sum of sinusoids. Because the time duration of the sinusoids is infinite, the discrete Fourier transform of the signal reflects the spectral content of an entire signal over time but does not indicate when the spectral content occurs. However, in some cases, evaluating the spectral content of a signal over a short time scale can be useful. You can use the STFT to evaluate spectral content over short time scales.
The STFT, also called the windowed Fourier transform or the sliding Fourier transform, partitions the time-domain input signal into several disjointed or overlapped blocks by multiplying the signal with a window function and then applies the discrete Fourier transform to each block. Window functions, also called sliding windows, are functions in which the amplitude tapers gradually and smoothly toward zero at the edges. Because each block occupies different time periods, the resulting STFT indicates the spectral content of the signal at each corresponding time period. When you move the sliding window, you obtain the spectral content of the signal over different time intervals. Therefore, the STFT is a function of time and frequency that indicates how the spectral content of a signal evolves over time. A complex-valued, 2-D array called the STFT coefficients stores the results of windowed Fourier transforms. The magnitudes of the STFT coefficients form a magnitude time-frequency spectrum, and the phases of the STFT coefficients form a phase time-frequency spectrum.
The STFT is one of the most straightforward approaches for performing time-frequency analysis and can help you easily understand the concept of time-frequency analysis. The STFT is computationally efficient because it uses the fast Fourier transform (FFT).
Without taking special care, however, the STFT is not invertible, meaning you cannot reconstruct the time-domain waveform from the STFT of a signal. For example, if you step the sliding window of the STFT without overlap, you cannot reconstruct the signal in the time domain from the STFT. The discrete Gabor transform is a special case of the STFT and is a kind of invertible algorithm. The inverse of the discrete Gabor transform is called the discrete Gabor expansion.
You can use the linear STFT method when you need the phase spectrum or when you do not need signal reconstruction. For example, the phase spectrum might be helpful in automatic speech-recognition applications. If you need only the magnitude spectrum in an application, use the quadratic STFT spectrogram method, which is the square of the linear STFT. The STFT spectrogram is one of the most popular quadratic time-frequency analysis methods because of its simplicity.
Use the TFA STFT VI to compute the STFT.
The time-frequency resolution of the STFT usually is defined as the product of the time resolution and the frequency resolution. The type of window you use affects the time-frequency resolution of the STFT. The Gaussian window has the optimal time-frequency resolution.
The window length also affects the time resolution and the frequency resolution of the STFT. A narrow window results in a fine time resolution but a coarse frequency resolution because narrow windows have a short time duration but a wide bandwidth. A wide window results in a fine frequency resolution but a coarse time resolution because wide windows have a long time duration but a narrow frequency bandwidth. This phenomenon is called the window effect. You cannot obtain a fine time resolution and a fine frequency resolution simultaneously using the STFT. With a time-invariant window, the STFT has the same time resolution and frequency resolution across the entire time-frequency plane.
The best window length depends on the characteristics of the signal you want to analyze. The window length should be small enough so that the windowed signal block is essentially stationary over the window interval and large enough so that the Fourier transform of the windowed signal block provides a reasonable frequency resolution. If the spectral content of the signal evolves over time slowly, which does not require a fine time resolution, set the window length large. If the spectral content of the signal changes relatively quickly, which requires a fine time resolution, set the window length small. For example, in speech signal processing, a time-domain window length of 25 ms is common.
The step size of the sliding window determines if overlap exists. If the step size is smaller than the window length, overlap exists. If the step size is greater than the window length, no overlap exists. Overlap of the sliding window makes the STFT smoother along the time axis. However, overlap requires more computation time and memory. If the signal length is large and the spectral content evolves slowly, it is not necessary to overlap the sliding window. If the signal length is small, overlap the sliding window to obtain a smoother STFT.