# Calculating total power for the signal

In my previous question I asked about calculating a single number as "Spectral Density" feature from signal data. We concluded that it is really a total power and article (link) authors wrote the wrong feature name.

I have a signal with 1 measurement per minute for a few days. It looks like this (in time domain obviously):

,timestamp,activity
0,2003-05-07 12:00:00,0
1,2003-05-07 12:01:00,143
2,2003-05-07 12:02:00,0
3,2003-05-07 12:03:00,20
4,2003-05-07 12:04:00,166


I can assume the noise is white and also other assumptions simplifying the calculations if needed (authors weren't exactly advanced in signal processing, they only used very simple features).

Questions:

1. How can I calculate the total power? It is "the variance plus the mean squared", so I should just calculate $$(\sum_{i}^N x[i]) / N$$ for the signal of length $$N$$? Or just sum the PSD (like in this link)?

2. Should I perform this calculation in the time domain (just time series like above), or should I calculate FFT and PSD (Power Spectral Density) first and calculate on PSD (which is also just an array of numbers, if I understand correctly)?

3. I have seen quite a few formulas for the total power. For finite number of samples and discrete measurements I have seen $$(\sum_{i}^N x[i])$$ divided by $$N$$, $$N+1$$, $$2N$$ or $$2N+1$$. Which one should I use? Does it have something to do with bias/unbiased sampling, i.e. in statistics we add +1 to the divisor to get unbiased calculations?

EDIT: above there should be $$x^2[n]$$ instead of $$x[n]$$

How can I calculate the total power? It is "the variance plus the mean squared", so I should just calculate $$(\sum_{i}^N x[i]) / N$$ for the signal of length $$N$$?

$$(\sum_{i}^N x[i]\color{red}{^2}) / N$$ is the average power, not the total energy. Just the sum $$\sum_{i}^N x[i]\color{red}{^2}$$ is what you're looking for.

Or just sum the PSD (like in this link)?

and

Should I perform this calculation in the time domain (just time series like above), or should I calculate FFT and PSD (Power Spectral Density) first and calculate on PSD (which is also just an array of numbers, if I understand correctly)?

The sum of the power in time domain (as above) and in frequency domain are the same, so that's just another way to compute the same (probably just more labor-intense).

I have seen quite a few formulas for the total power. For finite number of samples and discrete measurements I have seen (∑Nix[i]) divided by N, N+1, 2N or 2N+1. Which one should I use? Does it have something to do with bias/unbiased sampling, i.e. in statistics we add +1 to the divisor to get unbiased calculations?

Since you're really not looking for the power but the energy, neither. You don't have to divide at all.

• I think I made a slight mistake, it should be sum of (x[n])^2, right? May 16 at 10:19
• @qalis you're right! I didn't even spot that, so I've now edited my answer so that future readers see the square! May 16 at 10:31
• @Marcus If it's one measurement per minute for a couple of days, another important confirmation is that the signal is stationary over that period such that the power can be estimated. The OP said he "can assume the noise is white and other simplifying assumptions" but this one is particularly important and may be overlooked. Taking the ADEV of the data can provide further insight into the sufficiency in this regard. Do you agree? May 16 at 13:40
• yep! But the problematic point here is that "I'll take any simplifying assumption that explains the result" is questionable scientific practice, to say the least. I think the fundamental question to be answered is: What is, from a domain expert point of view, the reasonable set of assumptions, not, what might be the assumptions that give me the result I want to see. May 16 at 13:51