Implement a function to calculate the energy of a signal from its Discrete Fourier Transform (DFT) magnitudes. This task involves understanding the relationship between a signal's time-domain representation and its frequency-domain representation. The Fourier Transform is a mathematical tool used to decompose a signal into its constituent frequencies, and the DFT is a discrete-time equivalent.
The energy of a signal can be computed using the time-domain representation, but it can also be calculated using the frequency-domain representation, thanks to Parseval's theorem. This theorem states that the energy of a signal is equal to the sum of the squared magnitudes of its frequency components.
To compute the energy, follow these steps:
This technique is widely used in image processing to analyze the frequency components of an image.
signal_energy([2, 0, 2, 0])
2.0
signal_energy([2, 0, 2, 0]) returns 2.0.