I'm looking at the definition of signal energy (e.g. Wikipedia, cnx.org). For discrete signals, it's defined like the following, where $x(n)$ holds the signal:
$ Energy = \sum_{n=-\infty}^{\infty} |x(n)|^2 $
So my questions:
For a windowed, finite signal like
double signal[256]
, the sum is from 1 to 256 (or 0 to 255 in a program) rather than $-\infty$ to $\infty$, right? (I don't even know how I would sum over infinity.)Why does the energy formula have the absolute-value operator $|...|$? The result of taking the absolute value is squared anyways to produce a positive value, so taking the absolute value seems to be pointless. Is it because the $x(n)$ can be complex, so the absolute value of a complex number would be the scalar from Pythagoras' theorem?