FUNCTION REFERENCE
spectrogram
Complex short-time transforms and optional per-frame power density.
Complex short-time transforms and optional per-frame power density.
Syntax
[s,f,t] = spectrogram(x,window,noverlap,nfft)Syntax
[s,f,t,ps] = spectrogram(x,window,noverlap,nfft,fs)Returns raw windowed FFTs in columns, frequencies in a column and frame-center times in a row. Required segment parameters accept [] for pwelch defaults: symmetric Hamming of max(1,floor(2*N/9)) samples, 50 percent overlap, nfft=max(256,next power of two of window length). A scalar window selects a Hamming length. Uses complete frames, no boundary padding and no detrending. Default range is one-sided for real input, two-sided for complex input; trailing 'onesided', 'twosided', 'centered' select it. The fourth output is abs(s)^2/(fs*sum(window.^2)) with one-sided interior doubling. Without fs, frequency is radians/sample, times are samples, and density is power per radian/sample. 'power' selects squared-window-sum normalization. With fs, frequency is Hz and times are seconds. Request outputs; image plotting is unavailable.
Example
[s,f,t,ps] = spectrogram(sin(1:128),hamming(32),16,64,100);Differences from MATLAB: vectors only; no image plots, reassignment, or frequency-vector grids. FFT length must be at least window length and at most 1048576; work and memory limits apply.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.