0

I know by theory that the energy spectrum of a given signal is the sum of the squared fourier coefficient.

What if I have the real and imaginary part of the corresponding fourier coefficient, can I say that energy spectrum of a given signal is equal to sum of (real part + imaginary part)^2

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    you probably need to take the sum of absolute value square of the coefficient, i.e. `\sum_i |fourier_coefficient_i|^2`. However, afaik, the Fourier coefficients of a signal give you the energy density at that frequency (i.e. the spectral density over the energy domain), and summing their absolute value give you, by Parseval's theorem, the total energy. – vsoftco Jan 27 '15 at 22:04
  • 1
    I'm voting to close this question as off-topic because belongs on http://math.stackexchange.com/ –  Jan 28 '15 at 00:03
  • I'm voting to close this question as off-topic because this is math, not programming. Furthermore, OP's definitions are questionable to plain wrong. – Marcus Müller Sep 01 '15 at 14:08

2 Answers2

1

Not quite. You want:

sum of fft_result_magnitudes^2

which is:

sum of (sqrt(real_part^2 + imaginary_part^2)^2

which is:

sum of (real_part^2 + imaginary_part^2)

to get the sum of the squared magnitude of a complex FFT's results.

As for a fuller statement of Parseval's theorem, see:

http://en.wikipedia.org/wiki/Parseval%27s_theorem

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • Thank you! Did I get right that the **sum of the squared magnitudes** is equal to the **sum of squared fourier coefficients**? – Benaissa Tahiti Jan 27 '15 at 23:35
  • See the added wikipedia link above. Look how it is usually formulated for engineering and physics. – hotpaw2 Jan 27 '15 at 23:59
0

If result is a column vector with N elements, the energy spectrum is also a vector with N elements.

powerSpec = abs(result).^2;

The total energy can be calculated by

totalPower = sum(powerSpec);

or

totalPower = result' * result;

If result is a row vector you have to use

totalPower = result * result';
Heinz M.
  • 668
  • 3
  • 8