Main Content

FFT-Based Time-Frequency Analysis

Signal Processing Toolbox™ provides functions that return the time-dependent Fourier transform of a sequence, or display this information as a spectrogram. The time-dependent Fourier transform is the discrete-time Fourier transform for a sequence, computed using a sliding window. This form of the Fourier transform, also known as the short-time Fourier transform (STFT), has numerous applications in speech, sonar, and radar processing. The spectrogram of a sequence is the magnitude squared of the time-dependent Fourier transform versus time.

For more information about the spectrogram, see Spectrogram Computation with Signal Processing Toolbox. For an overview of other time-frequency representations of signals, see Time-Frequency Gallery.

Spectrogram Display

To display the spectrogram of a signal, you can use the pspectrum function. For example, generate two seconds of a signal sampled at 10 kHz. Specify the instantaneous frequency of the signal as a triangular function of time. To compute the spectrogram, divide the signal into segments of duration 0.0256 second and specify 86% segment-to-segment overlap. The leakage measures the ability of the sliding window to detect a weak tone from noise in the presence of a neighboring strong tone. Specify a leakage of 0.875.

fs = 10e3;
t = 0:1/fs:2;
x = vco(sawtooth(2*pi*t,0.75),[0.1 0.4]*fs,fs);

pspectrum(x,fs,"spectrogram", ...
    TimeResolution=0.0256,Overlap=86,Leakage=0.875)

Figure contains an axes object. The axes object with title Fres = 53.1206 Hz, Tres = 25.6 ms, xlabel Time (s), ylabel Frequency (kHz) contains an object of type image.

Persistence Spectrum

The persistence spectrum of a signal is a time-frequency view that shows the percentage of the time that a given frequency is present in a signal. The persistence spectrum is a histogram in power-frequency space. The longer a particular frequency persists in a signal as the signal evolves, the higher its time percentage and thus the brighter or "hotter" its color in the display.

Compute and display the persistence spectrum of the signal. Specify a time resolution of 0.01 second, 50% overlap between adjoining segments, and a leakage of 0.5.

pspectrum(x,fs,"persistence", ...
    TimeResolution=0.01,Overlap=50,Leakage=0.5)

Figure contains an axes object. The axes object with title Fres = 256.6745 Hz, Tres = 10 ms, xlabel Frequency (kHz), ylabel Power Spectrum (dB) contains an object of type image.

See Also

Apps

Functions

Related Topics