Updated 19 Jun 2009
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.
Peter Kabal (2023). PlotSpectrogram (https://www.mathworks.com/matlabcentral/fileexchange/24321-plotspectrogram), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.