Continuous 1-D wavelet transform
This version of cwt
is no longer recommended. Use the updated
cwt
instead.
coefs = cwt(x,scales,'
wname
')
coefs = cwt(x,scales,'wname
','plot')
coefs = cwt(x,scales,'wname
','coloration')
coefs = cwt(x,scales,'wname
','coloration',xlim)
[coefs,sgram] = cwt(x,scales,'wname
','scal')
[coefs,sgram] = cwt(x,scales,'wname
','scalCNT')
[coefs,frequencies] = cwt(x,scales,wname
,
samplingperiod)
[coefs,sgram,frequencies] = cwt(x,scales,wname
,
samplingperiod,'scal')
coefs = cwt(x,scales,'
returns
the continuous wavelet transform (CWT) of the real-valued signal wname
')x
.
The wavelet transform is computed for the specified scales using the analyzing wavelet
wname
. scales
is a 1-D vector with
positive elements. The character vector or string scalar
wname
denotes a wavelet recognized by
wavemngr
. coefs
is a matrix with the number
of rows equal to the length of scales
and number of columns equal to
the length of the input signal. The k-th row of coefs
corresponds to
the CWT coefficients for the k-th element in the scales vector.
coefs = cwt(x,scales,'
plots the continuous wavelet transform coefficients, using default
wname
','plot')coloration
'absglb'
.
coefs = cwt(x,scales,'
uses the specified coloration. See More About for coloration options.wname
','coloration')
coefs = cwt(x,scales,'
colors the coefficients using coloration and wname
','coloration',xlim)xlim
, where
xlim
is a vector, [x1 x2]
, with 1 ≤
x1
< x2
≤
length(x)
.
[coefs,sgram] = cwt(x,scales,'
returns and plots the scalogram. wname
','scal')'scal'
produces an image plot of the
scalogram.
[coefs,sgram] = cwt(x,scales,'
displays a contour representation of the scalogram. wname
','scalCNT')
[coefs,frequencies] = cwt(x,scales,
returns the frequencies in cycles per unit time corresponding to the scales and the
analyzing wavelet wname
,
samplingperiod)wname
. samplingperiod
is
a positive real-valued scalar. If the units of samplingperiod
are
seconds, the frequencies are in hertz.
[coefs,sgram,frequencies] = cwt(x,scales,
returns the scalogram and the frequencies corresponding to the scales and the analyzing
wavelet. If you have at least two elements in wname
,
samplingperiod,'scal')scales
, you can also
use the flag 'scalCNT'
to output the scalogram. The
samplingperiod
is only used in the conversion of scales to
frequencies. Specifying samplingperiod
does not affect the appearance
of plots generated by cwt
.
Plot the continuous wavelet transform and scalogram using sym2 wavelet at all integer scales from 1 to 32, using a fractal signal as input:
load vonkoch vonkoch=vonkoch(1:510); len = length(vonkoch); cw1 = cwt(vonkoch,1:32,'sym2','plot'); title('Continuous Transform, absolute coefficients.') ylabel('Scale') [cw1,sc] = cwt(vonkoch,1:32,'sym2','scal'); title('Scalogram') ylabel('Scale')
Compare discrete and continuous wavelet transforms, using a fractal signal as input:
load vonkoch vonkoch=vonkoch(1:510); len=length(vonkoch); [c,l]=wavedec(vonkoch,5,'sym2'); % Compute and reshape DWT to compare with CWT. cfd=zeros(5,len); for k=1:5 d=detcoef(c,l,k); d=d(ones(1,2^k),:); cfd(k,:)=wkeep(d(:)',len); end cfd=cfd(:); I=find(abs(cfd) <sqrt(eps)); cfd(I)=zeros(size(I)); cfd=reshape(cfd,5,len); % Plot DWT. subplot(311); plot(vonkoch); title('Analyzed signal.'); set(gca,'xlim',[0 510]); subplot(312); image(flipud(wcodemat(cfd,255,'row'))); colormap(pink(255)); set(gca,'yticklabel',[]); title('Discrete Transform,absolute coefficients'); ylabel('Level'); % Compute CWT and compare with DWT subplot(313); ccfs=cwt(vonkoch,1:32,'sym2','plot'); title('Continuous Transform, absolute coefficients'); set(gca,'yticklabel',[]); ylabel('Scale');
Daubechies, I. Ten Lectures on Wavelets, Philadelphia, PA: Society for Industrial and Applied Mathematics (SIAM), 1992.
Mallat, S. A Wavelet Tour of Signal Processing, San Diego, CA: Academic Press, 1998.