Main Content

New Wavelet for CWT

This example illustrates how to generate a new wavelet starting from a pattern.

The principle for designing a new wavelet for CWT is to approximate a given pattern using least squares optimization under constraints leading to an admissible wavelet well suited for the pattern detection using the continuous wavelet transform [1].

Load an original pattern: a pseudo sine.

load ptpssin1
who
Your variables are:

IntVAL   X        Y        caption  

The variables X and Y contain the pattern. Integrate the pattern over the interval [0, 1]. Plot the pattern.

dX = max(diff(X));
patternInt = dX*sum(Y);
disp(['Integral of pattern = ',num2str(patternInt)]);
Integral of pattern = 0.15915
plot(X,Y)
title('Original Pattern')
grid on

The pattern on the interval [0, 1] integrates to 0.15915. So it is not a wavelet but it is a good candidate since it oscillates like a wavelet.

To synthesize a new wavelet adapted to the given pattern, use a least squares polynomial approximation of degree 6 with constraints of continuity at the beginning and the end of the pattern.

[psi,xval,nc] = pat2cwav(Y, 'polynomial',6, 'continuous');

The new wavelet is given by xval and nc*psi.

figure
plot(X,Y,'-',xval,nc*psi,'--')
grid on
legend('Original Pattern','Adapted Wavelet','Location','NorthWest')

Check that psi satisfies the definition of a wavelet by confirming that it integrates to zero and has L2 norm is equal to 1.

dxval = max(diff(xval));
newWaveletIntegral = dxval*sum(psi);
disp(['Integral of new wavelet = ',num2str(newWaveletIntegral)])
Integral of new wavelet = 1.9626e-05
newWaveletSqN = dxval*sum(psi.^2);
disp(['New wavelet has L2-norm = ',num2str(newWaveletSqN)])
New wavelet has L2-norm = 1

References

[1] Misiti, M., Y. Misiti, G. Oppenheim, and J.-M. Poggi. Les ondelettes et leurs applications. France: Hermes Science/Lavoisier, 2003.

See Also