MATLAB: How to calculate the mean-squared spectrogram instead of PSD spectrogram

Signal Processing Toolbox

I use the SPECTROGRAM function on a signal as shown below:
T = 0:0.001:2;
X = chirp(T,100,1,200,'q');
spectrogram(X,128,120,128,1E3);
However, I would like to plot the mean-squared or MS spectrum instead of Power Spectral Density (PSD).

Best Answer

This feature is not available in the Signal Processing Toolbox in MATLAB 7.3 (R2006b).
To work around this issue, spectrum objects are available that allow you to calculate the mean-squared spectrum.
For example, you can perform the following in the MATLAB command prompt to view the MS spectrum:
Fs=1000;
t=0:1/Fs:.3;
x=cos(2*pi*t*200)+randn(size(t));
Hs=spectrum.periodogram;
msspectrum(Hs,x,'Fs',Fs)