TFA STFT (Waveform) VI
- Updated2024-07-30
- 5 minute(s) read
Computes the short-time Fourier transform (STFT) of signal. Wire data to the signal input to determine the polymorphic instance to use or manually select the instance.
Use the pull-down menu to select an instance of this VI.

Inputs/Outputs
![]() extension specifies the method to use to pad data at the borders of the input signal to lessen discontinuity. The extension length is half the window length. ![]() signal specifies the input signal. ![]() time-frequency sampling info specifies the density to use to sample the signal in the time-frequency domain and defines the size of the resulting 2D time-frequency array.
![]() window info specifies the sliding window to use to compute the STFT and defines the resolution of the resulting time-frequency representation. Use the user defined window input to specify a customized window.
![]() error in describes error conditions that occur before this node runs. This input provides standard error in functionality. ![]() user defined window specifies the coefficients of the sliding window to use to compute the STFT. If you specify a value for user defined window, this VI ignores the settings in the window info input. ![]() STFT coef returns the linear time-frequency representation of the signal. Use the TFA Coefficients Indicator to display the magnitude of STFT coef on an intensity graph. ![]() scale info returns the time scale and the frequency scale information of the time-frequency representation, including the time offset, the time interval between every two contiguous rows, the frequency offset, and the frequency interval between every two contiguous columns of STFT coef. Use the TFA Get Time and Freq Scale Info VI to return detailed information about the time scale and the frequency scale. ![]() error out contains error information. This output provides standard error out functionality. |
TFA STFT Details
The short-time Fourier transform (STFT) is the simplest method to use to analyze a time-varying signal or nonstationary signal whose frequency component varies over time. To compute the STFT of an entire signal, this VI uses a sliding window to divide the signal into several blocks and then applies the fast Fourier transform (FFT) to each data block to obtain the frequency contents. You can overlap the sliding window. The following illustration shows the computing procedure of the STFT:
The STFT aligns the center of the first sliding window with the first sample of the signal and extends the signal at the beginning with zeros or the signal itself. L is the window length, and dM is the step size to move the sliding window.
You can use the following equation to compute the STFT:
where s[i] is the signal, is the window function, L is the window length, dM is time step, and N is frequency bins. The window function determines the joint time-frequency resolution of the STFT. The longer the window length, the better the frequency resolution and the worse the time resolution. When dM is greater than or equal to the window length, L, no overlap exists between sliding windows. When dM is smaller than the window length, the overlap in percent equals 100×((L-dM)/L). For example, if you set the window length to 256 and time steps to 64, the overlap is 75%.