## Documentation Center |

Build wavelet from pattern

`[PSI,XVAL,NC] = pat2cwav(YPAT,METHOD,POLDEGREE,REGULARITY)`

`[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') ; plot(X,Y,'-',xval,nc*psi,'--'), 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 *L _{2}* norm
is equal to 1.

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

Was this topic helpful?