Any vector \(\vec{x}\in\mathbb{C}^N\) with \(N\) a power of 2 has a finite wavelet expansion. With the notation of my signal processing notes we have \[\vec{x} = \sum_{j=1}^N \lambda_j\vec{W}_j \qquad\text{where } \vec{W}_j=W^{-1}(\vec{e}_j), \quad \lambda_j=\vec{W}_j\cdot \vec{x}\] and \(W\) is the \(N\times N\) matrix of the corresponding wavelet transform.
The last \(N/2\) coefficients \(\lambda_j\) embody the finer details, the last level in the finite multiresolution analysis. The last \(N/2+N/4\) coefficients involve a level more and so on. In general to suppress the last \(L\) levels we have to replace the last \(M= (1-2^{-L})N\) coefficients by zeros. Let us call this operation \(Z_M\). In the reconstruction \[\vec{x}\longmapsto W^tZ_M\big(W\vec{x}\big)\] we should lose the detail corresponding to \(L\) levels.
In this example we take for \(N=1024\) the signal \(\vec{x}\) given by \[x_j= \begin{cases} t_j^{3/2}\cos\big( 3/t_j\big)& \text{if } t_j\in [0,1/2), \\ 4(1-t_j)^{2}\sin (5\pi t_j)& \text{if } t_j\in [1/2,1), \end{cases}\] with \(t_j=j/N\), \(0\le j<N\).
The aspect of the signal is like this:
The original signal |
We are going to see the effect of the reconstruction when we use different values of \(L\) and different wavelet transforms. The calculations were done with Octave with the code below and the output was plotted with this sage plotter.
The most simple case is the Haar transform. The effect is just transforming the values of the signal into wider and wider steps.
D2 (Haar), \(L=1\)
|
D2 (Haar), \(L=2\)
|
D2 (Haar), \(L=3\)
|
D2 (Haar), \(L=4\)
|
The response at the discontinuity is good but the overall aspect is not very exciting.
With D4 we obtain
D4, \(L=1\)
|
D4, \(L=2\)
|
D4, \(L=3\)
|
D4, \(L=4\)
|
Finally with D8, we obtain
D8, \(L=1\)
|
D8, \(L=2\)
|
D8, \(L=3\)
|
D8, \(L=4\)
|
In the previous cases with \(L=5\) we would get quite bad results but with D8 we obtain something reflecting somewhat the global aspect:
D8, \(L=5\)
|
|
It calls to two functions:
File wav_tr.m
|
File wav_tr_m.m
|
% Wavelet transform: f=filter x=signal |
% Wavelet transform: f=filter x=signal |