0
$\begingroup$

I am trying to calculate the power of a signal by using following two methods one is a power of a signal and another one is using the periodogram in Matlab as shown in the code.But why I am getting a different answer for the power?

x=[1 2 3 4 ];

s=0;

for i=1:length(x)
    s=s+x(i).^2;
end 

p=s/length(x);

D=fft(x);

P= sum((abs(D).^2)/length(x)); 

p=7.5, P=30

These are the formulas for both methods.

enter image description here

$\endgroup$
2
$\begingroup$

Discrete signals are by definition periodic and you need to calculate the power in both domains over one period with proper normalization.

In practice this means, you need to divide the spectrum by the FFT length. See https://en.wikipedia.org/wiki/Parseval%27s_theorem

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.