Question
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)? I would like to know the mathematical relation between output parameters S and P in the spectrogram function.
Expert Answer
John Williams
PhD Expert
Answered Aug 23, 2026
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
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →