I have a vector of signals and need to calculate the total energy. I have read somewhere that you can do this by summing up the entire vector and then finding the absolute value of the result. Is this correct? Could anyone suggest any tutorials, or, equations if this is the wrong method, thanks.
1 Answer
The energy of a discrete-time signal is the sum of the squares:
$$ E_x = \sum_n |x[n]|^2 $$
If you need the average power of your signal, divide the energy by the number of samples in your vector. Power is the average energy per sample of your signal.
If your signal vector is a sample of a stationary process (i.e. a recording clip of someone talking), then average power probably has more meaning than energy (which will grow with the sample length).
-
$\begingroup$ But my data samples aren't in blocks.. Say I have.. v1 = {128, 128, 127, 126} I sum up all the elements and then square them? $\endgroup$– PhorceCommented Sep 19, 2012 at 10:06
-
$\begingroup$ In matlab style: energy = sum( x.^2 ); square each element and then add. $\endgroup$– JuanchoCommented Sep 19, 2012 at 11:27
-
$\begingroup$ @Jusancho I get it now, so rather than squaring the sum of elements, you square each of the elements and then add? So e,g, x = {128, 128, 127, 126} x^2 = {16384, .., ..,} and then sum(x^2)? Thanks $\endgroup$– PhorceCommented Sep 19, 2012 at 11:38
-
$\begingroup$ Where does this formula come from? (what is the source?) $\endgroup$ Commented Feb 2, 2019 at 22:28