Continuous 1-D wavelet transform

**See cwt for information on the older
version of the cwt. The older version is no longer
recommended.**

`wt = cwt(x)`

`wt = cwt(x,wname)`

```
[wt,f] =
cwt(___,fs)
```

```
[wt,period]
= cwt(___,ts)
```

```
[wt,f,coi]
= cwt(___,fs)
```

```
[wt,period,coi]
= cwt(___,ts)
```

`[___] = cwt(___,Name,Value)`

`[___,coi,fb] = cwt(___)`

`[___,fb,scalingcfs] = cwt(___)`

`cwt(___)`

returns the continuous wavelet transform (CWT) of `wt`

= cwt(`x`

)`x`

. The
input, `x`

, is a double-precision real- or complex-valued
vector, or a single-variable regularly sampled timetable and must have at least
four samples. The CWT is obtained using the analytic Morse wavelet with the
symmetry parameter (gamma) equal to 3 and the time-bandwidth product equal to
60. `cwt`

uses 10 voices per octave. The minimum and maximum
scales are determined automatically based on the energy spread of the wavelet in
frequency and time. If `x`

is real-valued,
`wt`

is a 2-D matrix where each row corresponds to one
scale. The column size of `wt`

is equal to the length of
`x`

. If `x`

is complex-valued,
`wt`

is a 3-D matrix, where the first page is the CWT for
the positive scales (analytic part or counterclockwise component) and the second
page is the CWT for the negative scales (anti-analytic part or clockwise
component).

The `cwt`

function uses L1 normalization. With L1
normalization, if you have equal amplitude oscillatory components in your data
at different scales, they will have equal magnitude in the CWT. Using L1
normalization shows a more accurate representation of the signal. See L1 Norm for CWT and Sinusoid and Wavelet Coefficient Amplitudes.

The `cwt`

function supports GPU code generation. See GPU Code Generation for more
information.

`[`

specifies the sampling frequency, `wt`

,`f`

] =
cwt(___,`fs`

)`fs`

, in Hz as a positive
scalar. `cwt`

uses `fs`

to determine the
scale-to-frequency conversions and returns the frequencies
`f`

in Hz. If you do not specify a sampling frequency,
`cwt`

returns `f`

in cycles per
sample. If the input `x`

is complex, the scale-to-frequency
conversions apply to both pages of `wt`

. If
`x`

is a timetable, you cannot specify
`fs`

. `fs`

is determined from the
RowTimes of the timetable.

`[`

specifies the sampling period, `wt`

,`period`

]
= cwt(___,`ts`

)`ts`

, as a positive `duration`

scalar. The
`duration`

can be in years, days, hours, minutes, or
seconds. `cwt`

uses `ts`

to compute the
scale-to-period conversion and returns the time periods in
`period`

. The array of durations in
`period`

has the same format property as
`ts`

. If the input `x`

is complex, the
scale-to-period conversions apply to both pages of `wt`

. If
`x`

is a timetable, you cannot specify
`ts`

. `ts`

is determined from the
RowTimes of the timetable when you set the `'PeriodLimits'`

name-value pair.

`[___] = cwt(___,`

returns the CWT with additional options specified by one or more
`Name,Value`

)`Name,Value`

pair arguments.

`[___,`

returns the filter bank used in the CWT. See `coi`

,`fb`

] = cwt(___)`cwtfilterbank`

.

`[___,`

returns the scaling coefficients if the analyzing wavelet is
`fb`

,`scalingcfs`

] = cwt(___)`'morse'`

or `'amor'`

. Scaling
coefficients are not supported for the bump wavelet.

`cwt(___)`

with no output arguments plots the
CWT scalogram. The scalogram is the absolute value of the CWT as a function of
time and frequency. Frequency is plotted on a logarithmic scale. The cone of
influence showing where edge effects become significant is also plotted. Gray
regions outside the dashed white line delineate regions where edge effects are
significant. If the input signal is complex-valued, the positive
(counterclockwise) and negative (clockwise) components are plotted in separate
scalograms.

If you do not specify a sampling frequency or sampling period, the frequencies are plotted in cycles per sample. If you specify a sampling frequency, the frequencies are in Hz. If you specify a sampling period, the scalogram is plotted as a function of time and periods. If the input signal is a timetable, the scalogram is plotted as a function of time and frequency in hertz and uses the RowTimes as the basis for the time axis.

To see the time, frequency, and magnitude of a scalogram point, enable data tips in the figure axes toolbar and click the desired point in the scalogram.

Before plotting, `cwt`

clears (`clf`

) the current
figure. To plot the scalogram in a subplot, use a plotting
function.

If you are taking the CWT of multiple time series, it is more efficient to precompute and use a CWT filter bank than repeatedly apply the

`cwt`

function. See Using CWT Filter Bank on Multiple Time Series.

[1] Lilly, J. M., and S. C. Olhede. “Generalized Morse
Wavelets as a Superfamily of Analytic Wavelets.” *IEEE
Transactions on Signal Processing*. Vol. 60, No. 11, 2012,
pp. 6036–6041.

[2] Lilly, J. M., and S. C. Olhede. “Higher-Order
Properties of Analytic Wavelets.” *IEEE Transactions
on Signal Processing*. Vol. 57, No. 1, 2009, pp. 146–160.

[3] Lilly, J. M. *jLab: A data analysis package
for Matlab*, version 1.6.2. 2016. http://www.jmlilly.net/jmlsoft.html.

[4] Lilly, J. M. “Element
analysis: a wavelet-based method for analysing time-localized events in noisy time
series.” *Proceedings of the Royal Society A.* Volume 473:
20160776, 2017, pp. 1–28. dx.doi.org/10.1098/rspa.2016.0776.