# Calculating the total energy of a signal

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).

• 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? Sep 19 '12 at 10:06
• In matlab style: energy = sum( x.^2 ); square each element and then add. Sep 19 '12 at 11:27
• @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 Sep 19 '12 at 11:38
• Where does this formula come from? (what is the source?) Feb 2 '19 at 22:28