Alright, I'll try to take a shot at giving you an explanation of what's going on with the DWT.
So in the CWT, basically what you are doing is you are generating the wavelet coefficients by convolving the signal with each scale and shift of the mother wavelet function. However, the problem with doing this is that when you analyze the low frequency components of the signal, you are oversampling, or performing the wavelet analysis too often. Also, the relationship between time and frequency localization is much like the relationship between velocity and position localization in quantum mechanics, and when you perform the CWT this inequality is violated for some time/frequency scales. Essentially, with regard to the CWT, the transform is redundant at low frequency scales.
However the DWT doesn't have this problem because the DWT effectively downsamples the signal at each level. The DWT is basically just two filters, a highpass and a lowpass filter. The highpass filter produces the "detail" coefficients, and the lowpass filter produces the "average" coefficients. However, keep in mind that calculating the moving average of a signal is a form of lowpass filtering. Thus when we perform the lowpass filter and get the "average" DWT coefficients, those coefficients are basically just the low frequency components of the signal. And, since we know they are lower in frequency, we know that in the digital case we need less data points to represent a signal lower frequencies. The lowpass and highpass filtering is then repeated for each level of the DWT that can be computed. The level is dependent on the length of the signal. If a signal has $$k$$ data points, where $$k = 2^N$$
then the DWT can be computed to N
levels.
I'll try to give a real life example. Lets say you have a signal of 1024 samples, sampled at a rate of $$4\pi \text{ Hz.}$$ Based on the Nyquist criterion, the highest frequency that can be resolved by the signal is $$2\pi \text{ Hz.}$$Computing the first level of the DWT will result in two vectors, each of length 512. One is from the highpass filter, the other from the lowpass (these vectors are sometimes called high/lowpass filter banks). The highpass coefficients are the cD1
coefficients, representing frequencies in the range of one to two pi, and the lowpass coefficients are the cA1
coefficients representing frequencies in the range of zero to one pi. The DWT is applied again to the lowpass coefficients resulting in two vectors each of length 256, and this time the lowpass filter bank represents frequencies in the range 0 to 1/2 pi. This process is repeated 10 times (for this case, 2^10 = 1024), as the last time will result in lowpass and highpass filter banks each of length 1.
Basically at higher scales of the DWT, we get better frequency resolution, but poorer time resolution. Lower scales have better time resolution but poorer frequency resolution. I'll also give you the link to a good tutorial on this stuff by Polikar : http://person.hst.aau.dk/enk/ST8/wavelet_tutotial.pdf
To reconstruct the signal, simply apply the inverse DWT for the number of levels which you want to reconstruct.
EDIT: Forgot to mention that the FFT is not needed, you are already filtering based on frequencies.
x
of length $65536=2^{16}$, the DWT will NEVER give you more than 16 levels, ie 16 frequency bins... If you want to estimate precisely the frequencies of your signal, you must use CWT instead. $\endgroup$