This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Build wavelet from pattern




[PSI,XVAL,NC] = pat2cwav(YPAT,METHOD,POLDEGREE,REGULARITY) computes an admissible wavelet for CWT (given by XVAL and PSI) adapted to the pattern defined by the vector YPAT, and of norm equal to 1.

The underlying x-values pattern is set to

xpat = linspace(0,1,length(YPAT))

The constant NC is such that NC*PSI approximates YPAT on the interval [0,1] by least squares fitting using

  • a polynomial of degree POLDEGREE when METHOD is equal to 'polynomial'

  • a projection on the space of functions orthogonal to constants when METHOD is equal to 'orthconst'

The REGULARITY parameter defines the boundary constraints at the points 0 and 1. Allowable values are 'continuous', 'differentiable', and 'none'.

When METHOD is equal to 'polynomial'

  • if REGULARITY is equal to 'continuous', POLDEGREE must be greater than or equal to 3.

  • if REGULARITY is equal to 'differentiable', POLDEGREE must be greater than or equal to 5.


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 (see Misiti et al.).

load ptpssin1; 
plot(X,Y), title('Original Pattern')

[psi,xval,nc] = pat2cwav(Y, 'polynomial',6, 'continuous') ;
title('Original Pattern and Adapted Wavelet (dashed line)')

You can check that psi satisfies the definition of a wavelet by noting that it integrates to zero and that its L2 norm is equal to 1.

dx = xval(2)-xval(1);
Mu = sum(psi*dx)
L2norm = sum(abs(psi).^2*dx)


Misiti, M., Y. Misiti, G. Oppenheim, J.-M. Poggi (2003), “Les ondelettes et leurs applications,” Hermes.

Introduced before R2006a

Was this topic helpful?