This program plots spectrograms (intensities versus frequencies, plotted against time).


Updated 19 Jun 2009

View License

This program plots spectrograms (vertical slices of intensities versus frequencies, with slices plotted against time). PlotSpectrogram is designed for ease of use.
• Intensities are in log units, with the dynamic range limited (80 dB by default). This strategy avoids the problem of low level portions of the spectrogram expanding the dynamic range and thereby obscuring the detail of the energetic portions.
• The intensities are calculated as absolute units of dBov (decibels relative to overload).
• The time-frequency resolution of the spectrogram can be controlled. The bandwidth resolution of the spectrogram can be directly specified. The default is a narrowband spectrogram. Optionally, the analysis window can be specified in terms of coefficients, bandwidth, or length.
• The frequency transform properly takes into account the time-aliasing when analyzing long windows (corresponding to small bandwidths).
• The number of spectrogram slices can be specified (default 500).
• The number of frequency points can be specified (default is to automatically choose either 513 or 1025 values, depending on the window length).
• An optional pre-emphasis can be applied to better show the high frequency intensities.
• All windows are centered at their respective time points. This means that the windows at the end points of the time interval will include samples on both sides of the end points.
• A subset of frequencies can be plotted to give an expanded view.
• The default plot uses a gray-scale (dark is more intense). The spectrogram can optionally be colorized using the SpecColorMap (included). This mapping adds color (pale yellow through red going to black) but also reproduces properly in gray-level when photocopied.

Cite As

Peter Kabal (2023). PlotSpectrogram (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Time-Frequency Analysis in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!




Version Published Release Notes

Update to BSD License - no files changed