Continuous 1-D wavelet transform
information on the older version of the
The older version is no longer recommended.
the sampling frequency,
fs, in Hz as a positive
fs to determine
the scale-to-frequency conversions and returns the frequencies,
in Hz. If you do not specify a sampling frequency,
cycles per sample. You can use this syntax with any of the arguments
from the previous syntaxes.
the sampling interval,
ts, as a positive
duration scalar. The
be in years, days, hours, minutes, or seconds.
compute the scale-to period conversion and returns the time periods
period. The array of durations in
the same format property as
[___] = wtmm(___, returns
the WTMM with additional options specified by one or more
cwt(___) with no output arguments
plots the CWT scalogram, which is the absolute value of the CWT as
a function of time and frequency. The cone of influence is also plotted.
If you do not specify a sampling frequency,
or time interval,
ts, the frequencies are plotted
in cycles per sample. If you specify a sampling frequency,
the frequencies are in Hz. If you specify a sampling duration, the
plot is a function of time and periods.
The y-axis of the scalogram uses a log2 scale.
If you use a data cursor, the actual y-value is
displayed. For example, if the axis value is approximately 0.125,
the data cursor y-value is –3.01, which
you can verify using
Obtain the continuous wavelet transform of a speech sample using default values.
load mtlb; w = cwt(mtlb);
Obtain the continuous wavelet transform of a speech sample using the bump wavelet instead of the default Morse wavelet.
load mtlb; cwt(mtlb,'bump',Fs);
Compare the result obtained from the CWT using the default Morse wavelet.
Create two sine waves with frequencies of 32 and 64 Hz. The data is sampled at 1000 Hz. The two sine waves have disjoint support in time.
Fs = 1e3; t = 0:1/Fs:1; x = cos(2*pi*32*t).*(t>=0.1 & t<0.3) + sin(2*pi*64*t).*(t>0.7);
Add white Gaussian noise with a standard deviation of 0.05.
wgnNoise = 0.05*randn(size(t)); x = x + wgnNoise;
Obtain and plot the cwt using a Morse wavelet.
Obtain the CWT of Kobe earthquake data. The sampling frequency is 1 Hz.
Plot the earthquake data.
plot((1:numel(kobe))./60,kobe); xlabel('mins'); ylabel('nm/s^2'); grid on title('Kobe Earthquake Data');
Obtain the CWT, frequencies, and cone of influence.
[wt,f,coi] = cwt(kobe,1);
Plot the data, including the cone of influence.
Obtain the CWT, time periods, and cone of influence by specifying a time duration instead of a sampling frequency.
[wt,periods,coi] = cwt(kobe,minutes(1/60));
View the same data by specifying a sampling period input instead of a frequency.
x— Input signal
Input signal, specified as a row or column vector.
be a 1-D, real-valued signal with at least four samples.
wname— Analytic wavelet
Analytic wavelet used to compute the CWT, specified as
'bump'. These character vectors specify the
analytic Morse, Morlet, or bump wavelet, respectively.
The default Morse wavelet uses a symmetry parameter, , that is equal to 3 and has a time-bandwidth product that of 60.
fs— Sampling frequency
Sampling frequency, in Hz, specified as a positive scalar. If
fs, then you cannot specify
ts— Time duration
Specify optional comma-separated pairs of
Name is the argument
Value is the corresponding
Name must appear
inside single quotes (
You can specify several name and value pair
arguments in any order as
'ExtendSignal',falseindicates that the signal is not extended.
'ExtendSignal'— Extend input signal symmetrically
Option to extend the input signal symmetrically by reflection,
specified as the comma-separated pair consisting of
the signal symmetrically can mitigate boundary effects. If you specify
then the signal is extended. If you specify
then the signal is not extended.
'VoicesPerOctave'— Number of voices per octave
10(default) | even integer from 4 to 48
Number of voices per octave to use for the CWT, specified as
the comma-separated pair consisting of
an even integer from 4 to 48. The CWT scales are discretized using
the specified number of voices per octave. The energy spread of the
wavelet in frequency and time automatically determines the minimum
and maximum scales.
'NumOctaves'— Number of octaves
Number of octaves, specified as the comma-separated pair consisting
'NumOctaves' and a positive integer. The number
of octaves cannot exceed
NumOctaves value overrides the automatic
determination of the maximum scale. If you do not need to examine
lower frequency values, use a smaller
'TimeBandwidth'— Time-bandwidth product of Morse wavelet
Time-bandwidth product of the Morse wavelet, specified as the
comma-separated pair consisting of
a scalar greater than 3 and less than or equal to 120. The symmetry
parameter, gamma (),
is fixed at 3. Wavelets with larger time-bandwidth products have larger
spreads in time and narrower spreads in frequency.
If you specify
'TimeBandwidth', you cannot
'WaveletParameters'. To specify both the
symmetry and time-bandwidth product, use
'WaveletParameters'— Symmetry and time-bandwidth product of Morse wavelet
(3,60)(default) | two-element vector of scalars
Symmetry and time-bandwidth product of Morse wavelet, specified
as the comma-separated pair consisting of
a two-element vector of scalars.
The first element is the symmetry, , which must be greater than or equal to 1. The second element is the time-bandwidth product which must be greater than . The ratio of the time-bandwidth product to cannot exceed 40.
When is equal to 3, the Morse wavelet is perfectly symmetric in the frequency domain and the skewness is 0. When is greater than 3, the skewness is positive. When is less than 3, the skewness is negative.
If you specify
'WaveletParameters', you cannot
wt— Continuous wavelet transform
Continuous wavelet transform, returned as a matrix of complex
values. By default,
cwt uses the analytic Morse
(3,60) wavelet, where 3 is the symmetry and 60 is the time-bandwidth
cwt uses 10 voices per octave.
an Na-by-N matrix, where Na is
the number of scales, and N is the number of samples
x. The minimum and maximum scales are determined
automatically based on the energy spread of the wavelet in frequency
and time. See Algorithms for information
on how the scales are determined.
Complex Number Support: Yes
Frequencies of the CWT, returned as a vector. If you specify
a sampling frequency,
in Hz. If you do not specify
cycles per sample.
period— Time periods
Time periods, returned as an array of durations. The durations
are in the same format as
ts. Each row corresponds
to a period.
coi— Cone of influence
Cone of influence for the CWT, returned as either an array of
doubles or array of durations. The cone of influence indicates where
edge effects occur in the CWT. If you specify a sampling frequency,
the cone of influence is in Hz. If you specify a time duration,
the cone of influence is in periods. Due to the edge effects, give
less credence to areas that are outside or overlap the cone of influence.
To determine the minimum scale, first obtain the Fourier transform, of the base wavelet. Then, find the peak frequency of that transformed data. For Morse wavelets, dilate the wavelet so that the Fourier transform of the wavelet at radians is equal to 10% of the peak value. The smallest scale occurs at the largest frequency:
As a result, the smallest scale is the minimum of (2, ). For Morse wavelets, the smallest scale is usually . For the Morlet wavelet, the smallest scale is usually 2.
Both the minimum and maximum scales of the CWT are determined automatically based on the energy spread of the wavelet in frequency and time. To determine the maximum scale, CWT uses the following algorithm.
The standard deviation of the Morse wavelet in time, , is approximately , where is the time-bandwidth product. The standard deviation in frequency, , is approximately . If you scale the wavelet by some , he time duration changes to , which is the wavelet stretched to equal the full length (N samples) of the input. You cannot translate this wavelet or stretch it further without causing it to wrap, so the largest scale is .
Wavelet transform scales are powers of 2 and are denoted by . NV is the number of voices per octave, and j is from 0 to the largest scale. For a specific small scale, :
Converting to log2:
Therefore, the maximum scale is
Wavelet transforms commonly use L2 normalization of the wavelet. For the L2 norm, dilating a signal by 1/s, where s is greater than 0, is defined as follows:
The energy is now s times the original energy. To preserve the energy of the original signal, you must multiply the CWT by . When included in the Fourier transform, multiplying by this factor produces different weights being applied to different scales, so that the peaks at higher frequencies are reduced more than the peaks at lower frequencies.
In many applications, L1 normalization is better. The L1 norm definition does not include squaring the value, so the preserving factor is 1/s instead of . Instead of high-frequency amplitudes being reduced as in the L2 norm, for L1 normalization, all frequency amplitudes are normalized to the same value. Therefore, using the L1 norm shows a more accurate representation of the signal.
 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.
 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.
 Lilly, J. M. jLab: A data analysis package for Matlab, version 1.6.2. 2016. http://www.jmlilly.net/jmlsoft.html.