To compute the energy of the signal x
from its frequency spectrum X
, you can use the Parseval's theorem which states that the energy of a signal in the time domain is equal to the energy of its frequency spectrum.
To implement this in Matlab, you first need to compute the power spectrum of the signal x
using abs(X).^2
, take the sum of all the power values, and then multiply it by the frequency resolution (which is Fs/N
, where Fs
is the sampling frequency and N
is the length of the signal).
Here's the code snippet for computing the energy:
main.m253 chars10 lines
The variable energy
will contain the energy of the signal x
.
gistlibby LogSnag