Continuous 1-D wavelet coefficients.
Syntax
coefs = cwt(s,scales,'wname')
coefs = cwt(s,scales,'wname','plot')
Description
cwt is a one-dimensional wavelet analysis function.
coefs = cwt(s,scales,'wname') computes the continuous wavelet coefficients of the vector s at real, positive scales, using the wavelet whose name is 'wname' (see waveinfo).
coefs = cwt(s,scales,'wname','plot') computes, and in addition plots, the continuous wavelet transform coefficients.
Let s be the signal and
the wavelet. Then the wavelet coefficient of s at scale a and position b is defined by:

since s(t) is a discrete signal, we use a piecewise constant interpolation of the s(k) values, k = 1 to length(s).
Then for any strictly positive scale a, we compute Ca,b for b = 1 to length(s).
Output argument coefs contains the wavelet coefficients for the scales within the vector scales in the same order, stored rowwise.
Examples of valid uses are:
c = cwt(s,1:32,'meyr')
c = cwt(s,[64 32 16:-2:2],'morl')
c = cwt(s,[3 18 12.9 7 1.5],'db2')
Examples
This example demonstrates the difference between discrete and continuous wavelet transforms.
% Load original fractal signal.
load vonkoch
vonkoch=vonkoch(1:510);
lv = length(vonkoch);
subplot(311), plot(vonkoch);title('Analyzed signal.');
set(gca,'Xlim',[0 510])
% Perform discrete wavelet transform at level 5 by sym2.
% Levels 1 to 5 correspond to scales 2, 4, 8, 16 and 32.
[c,l] = wavedec(vonkoch,5,'sym2');
% Expand discrete wavelet coefficients for plot.
% Levels 1 to 5 correspond to scales 2, 4, 8, 16 and 32.
cfd = zeros(5,lv);
for k = 1:5
d = detcoef(c,l,k);
d = d(ones(1,2^k),:);
cfd(k,:) = wkeep(d(:)',lv);
end
cfd = cfd(:);
I = find(abs(cfd)<sqrt(eps));
cfd(I)=zeros(size(I));
cfd = reshape(cfd,5,lv);
% Plot discrete coefficients.
subplot(312), colormap(pink(64));
img = image(flipud(wcodemat(cfd,64,'row')));
set(get(img,'parent'),'YtickLabels',[]);
title('Discrete Transform, absolute coefficients.')
ylabel('level')
% Perform continuous wavelet transform by sym2 at all integer
% scales from 1 to 32.
subplot(313)
ccfs = cwt(vonkoch,1:32,'sym2','plot');
title('Continuous Transform, absolute coefficients.')
colormap(pink(64));
ylabel('Scale')
Algorithm

since s(t) = s(k), if 
then
so at any scale a, the wavelet coefficients Ca,b for b = 1 to length(s) can be obtained by convolving the signal s and a dilated and translated version of the
integrals of the form

(given by intwave), and taking finite difference
using diff.
See Also
wavedec, wavefun, waveinfo, wcodemat
[ Previous | Help Desk | Next ]