Wavelet transforms - cwt vs. cwtft

30 views (last 30 days)
CTWM
CTWM on 7 Jun 2015
Commented: Walter Roberson on 11 Sep 2021
I have an intermediate understanding of wavelet transforms and their application but I'm new to the matlab toolbox. I'm able to use the cwtft function but I'm having trouble with the cwt function. If I have a time series xn, that has a sample frequency fs I can generate a pcolor plot of time vs. frequency vs. wavelet power spectra (WPS=2*abs(sqrt(1/fs)*cwtS1.cfs).^2). I like plotting WPS instead of wavelet coefficients so that when I average in time I can get back to the power spectral density. If I try to do this using cwt I get a similar result but it looks much worse (not as smooth) and I think I have a normalization issue. Below is a sample code.
%using cwtft
%xn is some time series
N=length(xn); dt=1/fs;
fw=4*pi/(6+sqrt(2+6^2)); %morlet
s0=2*dt; ds=0.25; NbSc=100;
SCA={s0,ds,NbSc};
cwtS1 = cwtft(sig,'scales',SCA,'wavelet',{'morl',m});
Wn_s_cwt=sqrt(cwtS1.dt)*cwtS1.cfs;%cwtS1.cfs;%
scales = cwtS1.scales;
freq = 1./(scales.*fw);
pcolor((1:N)*dt,freq,2*abs(sqrt(1/fs)*cwtS1.cfs).^2); colorbar; shading flat; set(gca,'yscale','log');
%using cwt
scal=logspace(log10(10^5),log10(1),100);
cfs = cwt(xn,scal,'morl');
freq = scal2frq(scal,'morl',1/fs);
pcolor((1:N)*dt,freq,2*abs(sqrt(1/fs)*cfs).^2); colorbar; shading flat; set(gca,'yscale','log');
Does anyone know why the results are different? I know cwt computes in time space and cwtft computes in frequency space but they should give the same answer (I know this is probably due to my lack of understanding and implementation). I'm also a little confused about the difference between the scale input for cwt and cwtft.

Answers (1)

Lorenzo Bernardini
Lorenzo Bernardini on 15 Jan 2020
For the ones who had your same problem (or similar), check the following link out. There's a full explanation of the differences between cwt and cwtft.
Hope this would be of any help.
Lorenzo
  2 Comments
Walter Roberson
Walter Roberson on 11 Sep 2021
Michael Leconte comments
Why does the poster needs to give a link to Youtube video (Google). Answers should be self-contained, or provide the video itself in mp4 format.
Walter Roberson
Walter Roberson on 11 Sep 2021
@Michael Leconte
No, there has never been a requirement in MATLAB Answers that answers are self-contained.
You may be thinking of Stack Exchange -- but this is not Stack Exchange.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!