summing the ith frequencies with the ith amplitudes^2 from a spectrogram of a Harmonic

From http://i.imgur.com/Arctu.png where fi is the ith frequency component, ui is the amplitude of said frequency component, K is a constant, tau is time and t is the time integration variable I have used the following to spectrogram a harmonic that will be processed by the attached eqn:
[S, F, T, P] = spectrogram(A(800000:6*800000), 2^15, 1, (1:0.1:20)*10^4, 1/1.2e-7)
I don't have any problems with the first half of the eqn in the link, but the second half confuses me. You can't square a vector and I'm not certain that amplitude is P, or if frequency is taken from S or F. Would you take the peaks in the amplitude vector or take it time segment by time segment?
I appreciate any help.

Answers (2)

It is not the vector that is being squared, but each component.
A = [1 2 3 4];
A.^2 % Notice the '.' - it matters!
%
%
%
EDIT In response to your 'answer' below.
I don't know which variables form spectrogram you should be using. It is up to you to understand the problem and your particular application. For example, I don't know where you got those equations you posted, only you know that. Perhaps reading the SPECTROGRAM doc will help.
Ok, but which variables from spectrogram should I be using?

This question is closed.

Asked:

on 23 Apr 2011

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!