# Continuous vs discrete signal energy

I am looking to calculate the signal energy of real, sampled acoustic data. According to this source, the energy of a continuous signal is: $$\tag{1}\hspace{1cm} E_x = \int_{-\infty}^{+\infty}|x(t)|^2dt$$ This is intuitive as we are often taught that the energy is given by the area under the curve, for a power curve. Certainly the equation 1 can easily be approximated by the Riemann Sum which still retains the differential $$\tag{3}\hspace{1cm} S = \sum_{i=1}^{n} f(x_i)\Delta x_i$$

However, according to this source, the discrete energy calculation is given below as: $$\tag{2}\hspace{1cm} E_x= \sum_{-\infty}^{+\infty} |x(n)|^2$$

My question is why do we drop the differential ($$dt$$)?

• @Micheal Can you provide a citation for where you have seen the formula without $T_s$, as in your Eq. (2) ? Just for reference. Cheers. – teeeeee May 1 '20 at 16:56
• Certainly! This was the first source linked in the question: gaussianwaves.com/2013/12/power-and-energy-of-a-signal and this is from parseval's theorem from the wiki page en.wikipedia.org/wiki/Parseval%27s_theorem Under the section 'notation used in physics' – Michael Smith May 1 '20 at 17:56
• Adding to this. I understand wikipedia is not the best source, but it is unfortunately also the one that shows up the most often. And I think you can see this article on signal energy SOURCE, there is some information that appears counter to the information shared here and in the related question linked here. – Michael Smith May 1 '20 at 19:46
• I see. I think the expression given for Parseval's theorem on wiki is still okay. I just think it can't be called signal energy in that particular expression. To be fair, Wiki makes it clear that what they call $X[k]$ is actually the output of a DFT, which in order to apprximate the Fourier transform of x will need an extra factor of $\Delta f$. I have added an edit to my answer to try to explain what I mean. – teeeeee May 1 '20 at 20:27
• On this link en.wikipedia.org/wiki/Energy_(signal_processing) that you share... it seems there is a mistake right at the beginning. The expression for signal energy is given by the integral over $dt$, and then the very next line says that the units are $[\textrm{signal}^2]$! This can't be right. – teeeeee May 1 '20 at 20:37

I think you are correct. People are being fast and loose with the expression in your Eq. (2), but it captures the behaviour of the energy of the signal up to a constant $$T_s$$ factor (the sampling period), which is maybe why they do it.

As you say, the signal energy is given by $$E_s = \int_{-\infty}^{+\infty} |x(t)|^2\;dt \tag{1}$$ If you want to approximate this using a Riemann sum for the discrete case, the equivalent expression (depending on your choice of indexing) is $$E_s \approx \sum_{n=1}^{\infty} x[n]\; x^*[n]\cdot T_s \tag{2}$$

You can see immediately that there must be a factor of $$T_s$$ in there otherwise the dimensions of the units aren't consistent. The correct units of signal energy as given by Eq. (1) are $$[\textrm{signal}^2\cdot\textrm{time}]$$. If you drop the $$T_s$$ then the units of your Eq. (2) would just be $$[\textrm{signal}^2]$$, which are NOT the correct units for signal energy. See this related question for the units.

EDIT---------------------------------

The OP cited the wiki reference as the source of the confusion, specifically with the discrete version of Parseval's theorem. Parseval's theorem in continuous time says that the energy in the time domain and frequency domain are equal, and is written as

$$\int_{-\infty}^{+\infty} |x(t)|^2\;dt = \int_{-\infty}^{+\infty} |X(f)|^2\;df \tag{3}$$ where $$x(t)$$ is the signal, and $$X(f)$$ is its Fourier transform, defined by $$X(f) = \int_{-\infty}^{+\infty} x(t) e^{-2\pi i f t}\; dt. \tag{4}$$ You can verify together with Eq. (4) that the units of both sides of Eq.(3) are $$[\textrm{signal}^2\cdot\textrm{time}]$$, as they should be for signal energy. So far so good.

You can get a discrete version of Parseval's theorem by discretising both sides to get $$\sum_{n=0}^{N-1} |x[n]|^2\cdot T_s = \sum_{k=0}^{N-1} |X[k]|^2\cdot \Delta f \tag{5}$$ where $$T_s$$ is the sampling period, and $$\Delta f$$ is the separation of frequency bins (I have assumed that the length of the vector $$X[k]$$ and $$x[n]$$ are both equal to $$N$$ - this would be different if you had zero-padding, but remember that the extra zeroes would not contribute any extra signal energy). The Fourier transform $$X[k]$$ is the discrete version of $$X(f)$$, and is given by \begin{align} X[k] &= \sum_{n=0}^{N-1} x[n] \exp \Big( -2\pi i \frac{kn}{N} \Big) \cdot T_s \tag{6}\\ &= X_{\textrm{DFT}}[k]\cdot T_s \tag{7} \end{align} and we recognise $$X_{\textrm{DFT}}[k]$$ as being the result of the discrete Fourier transform (DFT) operation - this you might obtain directly from the output of the FFT function, for example in MATLAB. There is an extra factor of $$T_s$$ in the expression for $$X[k]$$, because it is an approximation of the continuous Fourier transform from Eq. (4) - again needed for the units to add up.

Now we can insert Eq. (7) into Eq. (5), and use the fact that $$\Delta f = F_s/N = 1/(NT_s)$$, where $$F_s$$ is the sampling frequency, to obtain \begin{align} \sum_{n=0}^{N-1} |x[n]|^2\cdot T_s &= \sum_{k=0}^{N-1} |X_{\textrm{DFT}}[k]\cdot T_s|^2\cdot \Delta f \tag{8}\\ &= \sum_{k=0}^{N-1} |X_{\textrm{DFT}}[k]|^2\cdot \frac{T_s^2}{NT_s}\tag{9}\\ \implies \sum_{n=0}^{N-1} |x[n]|^2 &= \frac{1}{N}\sum_{k=0}^{N-1} |X_{\textrm{DFT}}[k]|^2\;,\tag{10} \end{align} where the factors of $$T_s$$ have cancelled. This is the expression for Parseval's theorem given in the wikipedia link you cited, and is still valid. However, since we killed the factors of $$T_s$$, the units are now not signal energy units, and I personally wouldn't call the left hand side of Eq. (10) signal energy anymore (actually, it has units of signal power instead).

Hope that helps clear up a bit of the confusion. I always find it helpful to check the units at each stage as you go along, to keep track of things.

• This is excellent. I agree that Eq. (10) is not signal energy units, and Eq. (2) is more appropriate. It just surprised me how prevalent the left hand side of Eq. (10) is in sources. You Eq. (8) response also helped with identifying a scaling issue I was having in Matlab. Thank you. – Michael Smith May 1 '20 at 22:29
• No worries, glad you found it useful. I think it doesn't matter in many applications, but when you are trying to match to physical quantities then the proper scalings definitely can't be neglected. – teeeeee May 1 '20 at 23:17

The differential, $$dt$$, corresponds to the sampling period, $$T_s$$, when doing this conversion from continuous time to discrete time. The sampling period is something that will be specific to the problem that one is working on, so for the purposes of defining a discrete time energy it is assumed that $$T_s=1$$. If you want the integral to match the sum, then you need to include the sample period.

For example, a sinusoid over one period has energy $$\int_0^T \big|\text{cos}(2\pi ft)\big|^2 dt= \frac{1}{2}$$. To replicate in discrete time I attach a short MATLAB code to demonstrate how to include the sampling period.

Fs = 1000;              % sample rate
Ts = 1/Fs;              % sample period
t = 0:Ts:1-Ts;          % time vector
x = cos(2*pi*t);        % signal
Ex = sum(abs(x).^2)     % = 500 using standard equation, assumes Ts = 1
Ex2 = sum(abs(x).^2*Ts) % = 1/2, includes Ts to match integral

• Thank you for the response, it is quite surprising to me that people are supposed to just gather that $T_s = 1$. As the answer below mentions, they do seem to play a bit lose and fast. – Michael Smith May 1 '20 at 16:37