*MAINLY COPY FROM WIKI
Energy spectral density
Fourier transform\[F[x(t)] = \int_{-\infty}^{\infty} x(t)\exp(-i 2\pi f t) dt \]
inverse transform
\[ x(t) = \int_{-\infty}^{\infty} F[x(t)] \exp(i 2\pi f t) df \]
Energy spectral density describes how the energy of a signal or a time series is distributed with frequency. The term energy is used in the generalized sense of signal processing, that is, the energy E of a singal $x(t)$ is
\begin{equation}\label{eq:1}
E = \int_{-\infty}^{\infty} |x(t)|^2 dt.
\end{equation}
The energy spectral density is most suitable for signal with a finite total energy.
\[\int_{-\infty}^{\infty} |x(t)|^2 dt = \int_{-\infty}^{\infty} |\hat{x}(f)|^2 df, \]
where
\[ \hat{x}(f) = \int_{-\infty}^{\infty} \exp(-iwt) x(t) dt ,\]
is the Fourier transform of the signal and $w = 2\pi f$ is angular frequency.
Since the integrate on the right-hand side is the energy of the signal (see eq 1), the integrand $|\hat{x}(f)|^2$ can be interpreted as a density function describing the energy per unit frequency contained in the signal at the frequency $f$.
The energy spectral density of a signal $x(t)$ is defined as
\[S_{xx}(f) = |\hat{x}(f)|^2. \]
The definition to a discrete signal with an infinite number of values $x_n$ such as a signal sampled at discrete times $x_n = x(n \Delta t)$:
\[S_{xx}(f) = | \sum_{n=1}^{N}\exp(-iw n\Delta t) x_n \Delta t|^2 \]