What is the mathematical relation between the output parameters S and P in the function definition of spectrogram in Signal Processing Toolbox 6.9 (R2008a)?

2 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Jan 2010
This information has been incorporated into the documentation in the Signal Processing Toolbox 6.9 (R2009b). For previous releases, read below for any additional information:
As per the documentation of the spectrogram function,
[S,F,T,P] = spectrogram(x,window,noverlap,F,fs)
returns a matrix P containing the power spectral density (PSD) of each segment and S is the short time Fourier transform of the input signal vector x.
However, there are some scaling factors also involved, namely the scaling by power of the window used and scaling by sampling frequency fs. The exact mathematical relation is as follows:
P = Power of Signal/(fs*Power of the window)
% where Power of the window = window'*window
The following code demonstrates this relationship:
T = 0:0.001:2;
X = chirp(T,0,1,150);
F = 0:.1:100;
win = hamming(256);
[S,F,T,P] = spectrogram(X,win,250,F,1E3,'yaxis');
In this example, sampling frequency fs = 1e3, and window is Hamming of size 256.
Power of window = win'*win;
Power of Signal = S.*conj(S)/Power of window;
P = Power of Signal./Fs

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!