plot the spectrogram of a signal - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Science and Engineering : Signal Processing : Visualization : SignalProcessing/Spectrogram

SignalProcessing[Spectrogram] - plot the spectrogram of a signal

Calling Sequence





: string, rtable, list : a signal, the name of a file containing a signal, or a list of these



The Spectrogram command plots the spectrogram of one or more signals. Optionally, the amplitude of the signal and the power spectrum can be plotted along with the spectrogram. The input f can be the name of a file containing an audio signal, an rtable, or a list. See AudioTools:-Format for information about the kinds of files accepted.


If f is not an audio signal, then the samplerate option must be included. See the information about the samplerate option below.


If f is an m by n Matrix (or 2-dimensional Array), then it is assumed to contain n signals of length m. In this case, spectrograms of all signals are plotted and displayed in an array plot. Similarly, if f is an audio signal with multiple channels, then plots for all channels are produced.  If you do not wish to plot all signals, the channel and column options allow you to plot a subset.


If f is a list, then every element of the list must be a single-channel audio signal or a 1-dimensional Array.


The option fftsize determines the FFT window size and its value must be a power of 2 greater than 2.


The compactplot option allows multiple plots to be displayed more compactly. When this option is set to true, it is assumed the x-axis labels for all plots are identical and thus they are displayed for the bottommost plot only.


If includesignal or includesignal=true is given as an option, then the original signal is also plotted. If includesignal=t, where t is a list, is given, then the signal is plotted using the contents of t as additional plotting options.


The includepowerspectrum option is similar to the includesignal option but produces a plot of the power spectrum instead.


If the signal is particularly large and the reduceplot option is set to true, then the plot resolution is automatically reduced for efficient rendering. If reduceplot is a positive integer, then the plot is reduced by that factor. The default setting for this option is true.


The samplerate option is used to specify a sample rate, in the case where one cannot be deduced. Note that audio signals generated or recognized by the AudioTools package have the sample rate saved in their attributes. If f is not such a signal, then the sample rate must be provided using this option.


The window option you to specify the windowing command. Any of the windowing commands available in the SignalProcessing package can be used. The default is SignalProcessing:-HammingWindow. A string such as "Bartlett" may be provided and is interpreted as the SignalProcessing:-BartlettWindow command in this case.


Additional plot options may be provided and are applied to the spectrogram plot. The size and axes options are also automatically applied to the signal and power spectrum plots, if they have been requested. These may be overridden by suboptions given through the includesignal and includepowerspectrum options in list form.  


To change the coloring of the spectrogram, use the colorscheme option, as described on the plot/colorscheme help page.






See Also

AudioTools:-Format, SignalProcessing

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam