Continuous wavelet transform using FFT algorithm
cwtstruct = cwtft(sig)
cwtstruct = cwtft(sig,Name,Value)
cwtstruct = cwtft(...,'plot'
)
returns
the continuous wavelet transform (CWT) of the 1–D input signal cwtstruct
= cwtft(sig
)sig
. cwtft
uses
an FFT algorithm to compute the CWT. sig
can
be a vector, a structure array, or a cell array. If the sampling interval
of your signal is not equal to 1
, you must input
the sampling period with sig
in a cell array
or a structure array to obtain correct results. If sig
is
a cell array, sig{1}
is equal to your signal and sig{2}
is
equal to the sampling interval. If sig
is a structure
array, the field sig.val
contains your signal and sig.period
contains
the sampling interval.
By default, cwtft
uses the analytic Morlet
wavelet. See More
About for descriptions of valid analyzing wavelets.
For additional default values, see scales
in NameValue Pair Arguments.
returns
the continuous wavelet transform (CWT) of the 1–D input signal cwtstruct
= cwtft(sig
,Name,Value
)sig
with
additional options specified by one or more Name,Value
pair
arguments. See NameValue Pair Arguments for
a comprehensive list.
plots
the continuous wavelet transform. If the analyzing wavelet is realvalued,
the original signal along with the CWT coefficient magnitudes and
signed CWT coefficients are plotted. If the analyzing wavelet is complexvalued,
the original signal is plotted along with the moduli, real parts,
imaginary parts, and angles of the CWT coefficients. You can select
the radio button in the bottom left of the plot to superimpose the
signal's reconstruction using cwtstruct
= cwtft(...,'plot'
) icwtft
.

The 1–D input signal. If


Scales over which to compute the CWT. The value of
If 

Analyzing wavelet. The supported analyzing wavelets are:
See the More About for formal definitions of the supported analyzing wavelets and associated defaults. Default: 

Signal extension mode. See 

A structure array with six fields. The fields of the structure array are:

Compute and display the CWT of sine waves with disjoint support. The sampling interval is 1/1023.
N = 1024; % Sampling interval is 1/1023 t = linspace(0,1,N); y = sin(2*pi*4*t).*(t<=0.5)+sin(2*pi*8*t).*(t>0.5); % Because the sampling interval differs from the default % you must input it along with the signal % Using cell array input sig = {y,1/1023}; cwtS1 = cwtft(sig,'plot');
You can display or hide the reconstructed signal using the radio button at the bottom left of the figure. When you select the radio button, the maximum and quadratic relative errors are computed and displayed along with the reconstructed signal.
Reconstruct an approximation to a sum of disjoint sine waves
in noise using cwtft
to decompose the signal
and icwtft
to reconstruct
the approximation. Use the CWT coefficients to identify the scales
isolating the sinusoidal components. Reconstruct an approximation
to the signal based on those scales using the inverse CWT. To ensure
an accurate approximation to the based on select scales, use the default
power of two spacing in the CWT.
rng default % Reset random number generator for reproducible results N = 1024; % Sampling interval is 1/1023 t = linspace(0,1,N); y = sin(2*pi*4*t).*(t<=0.5)+sin(2*pi*8*t).*(t>0.5); ynoise = y+randn(size(t)); % Because the sampling interval differs from the default % you must input it along with the signal % Using structure array input sig = struct('val',ynoise,'period',1/1023); cwtS1 = cwtft(sig); scales = cwtS1.scales; MorletFourierFactor = 4*pi/(6+sqrt(2+6^2)); freq = 1./(scales.*MorletFourierFactor); contour(t,freq,real(cwtS1.cfs)); xlabel('Seconds'); ylabel('Pseudofrequency'); axis([0 t(end) 0 15]);
Extract the scales dominated by energy from the two sine waves and reconstruct a signal approximation using the inverse CWT.
cwtS2 = cwtS1; cwtS2.cfs = zeros(size(cwtS1.cfs)); cwtS2.cfs(13:15,:) = cwtS1.cfs(13:15,:); xrec = icwtft(cwtS2); subplot(2,1,1); plot(t,ynoise); title('Sum of Disjoint Sinusoids in Noise'); subplot(2,1,2); plot(t,xrec,'b'); hold on; axis([0 1 4 4]); plot(t,y,'r'); legend('Reconstructed Signal','Original Signal',... 'Location','NorthWest'); xlabel('Seconds'); ylabel('Amplitude');
[1] Daubechies, I. Ten Lectures on Wavelets, Philadelphia, PA: Society for Industrial and Applied Mathematics (SIAM), 1992.
[2] Farge, M. "Wavelet Transforms and Their Application to Turbulence", Ann. Rev. Fluid. Mech., 1992, 24, 395–457.
[3] Mallat, S. A Wavelet Tour of Signal Processing, San Diego, CA: Academic Press, 1998.
[4] Sun,W. "Convergence of Morlet's Reconstruction Formula", preprint, 2010.
[5] Torrence, C. and G.P. Compo. "A Practical Guide to Wavelet Analysis", Bull. Am. Meteorol. Soc., 79, 61–78, 1998.