Continuous 1-D wavelet transform
See cwt
for information on the older
version of the cwt
. The older version is no longer
recommended.
returns the continuous wavelet transform (CWT) of wt
= cwt(x
)x
. The input, x
, is a 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 Continuous Wavelet Transform of Two Complex Exponentials.
[
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 plotted 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.
Note
Before plotting, cwt
clears (clf
) the current
figure. To plot the scalogram in a subplot, use a plotting function. See
Plot CWT Scalogram in Subplot.
When performing multiple CWTs, for example inside a for-loop, the recommended
workflow is to first create a cwtfilterbank
object and then use the wt
object function. This workflow minimizes overhead and
maximizes performance. 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 60, no. 11 (November 2012): 6036–6041. https://doi.org/10.1109/TSP.2012.2210890.
[2] Lilly, J.M., and S.C. Olhede. “Higher-Order Properties of Analytic Wavelets.” IEEE Transactions on Signal Processing 57, no. 1 (January 2009): 146–160. https://doi.org/10.1109/TSP.2008.2007607.
[3] Lilly, J. M. jLab: A data analysis package for Matlab, version 1.6.2. 2016. http://www.jmlilly.net/jmlsoft.html.
[4] Lilly, Jonathan M. “Element Analysis: A Wavelet-Based Method for Analysing Time-Localized Events in Noisy Time Series.” Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 473, no. 2200 (April 30, 2017): 20160776. https://doi.org/10.1098/rspa.2016.0776.