3
$\begingroup$

I have difficulty to understand the results I get with implementing Parseval's Theorem in Python to DWT. I have the good results getting the Energy with Fourier transform and the time series in python:

# Parseval theorem energy
def ParsevalTheorem(data):
    energy_sum = 0
    for i in range(len(data)):
        energy_sum += abs(data[i])**2
    return energy_sum

# dwt_data[0] => approximation component at final level, dwt_data[1:] => detail components
def DWTParseval(dwt_data):
    details_sum = 0
    for i in range(len(dwt_data)-1):
        details_sum += ParsevalTheorem(dwt_data[i+1])
    approx_sum = ParsevalTheorem(dwt_data[0])
    final_sum = approx_sum + details_sum
    return final_sum

fourierTransform = np.fft.fft(short_signal)
print("fourier energy: ", ParsevalTheorem(np.abs(fourierTransform))/len(fourierTransform))
print("Org energy: ", ParsevalTheorem(short_signal))
print("DWT energy: ", DWTParseval(app1)) # app1 is haar discrete wavelet transform using pywt.wavedec(data, "haar", level = 3)

Results:

fourier energy:  1305035.7546624008
Org energy:  1305035.7546624022
DWT energy:  1309077.6827128115

I've gathered the information on using Parseval Theorem from equation: Equation Link1

https://cnx.org/contents/EQurkhlI@6.9:8jovwc5A@4/Generalizations-of-the-Basic-Multiresolution-Wavelet-System

I have also encountered another equation to get the Energy but if I divide the Approximation sum with it's length it's in whole different scope than the original signal energy: Equation Link2

enter image description here

I some what understand the Parseval theorem when dealing with fourier transform, but lost with these equations when dealing with DWT.

PS: I know there is more Pythonic way to do the code but I intend to apply it in a different language also.

$\endgroup$

1 Answer 1

3
$\begingroup$

Parseval's identity and Plancherel's theorem finally boil down to orthogonality. When one decomposes a data (with samples), via a scalar product, onto an orthogonal sequence (yielding coefficients), there exists a certain preservation (equality, up to a proportionality factor) of energy between samples and coefficients. There are some technical conditions, and in certain cases, one only get inequalities (cf. Bessel's inequality) or frame bounds.

The equation for the discrete wavelet transform (DWT) might be incomplete, with respect to the indices. I for instance think that in the second term of the RHS, the scaling factor should be $N_j$, not $N_J$ (and this depends a bit on how discrete wavelets are implemented). Basically, an orthogonal wavelet transform projects data onto basis elements gathered in groups called subbands. Each wavelet subband comes from $N_j$ vectors, with an additional $N_J$ vectors for the approximation. And normally, the total number of vectors should be (about, honestly, this depends on signal extension) the number of samples $N$, in other words: $N=N_J +\sum_{j=1}^JN_j$.

$\endgroup$
2
  • 1
    $\begingroup$ "technical coefficients"? :) $\endgroup$
    – Matt L.
    Jul 7, 2020 at 10:12
  • $\begingroup$ Excellent... Corrected $\endgroup$ Jul 7, 2020 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.