Some bugs(?) in cwt, continuous wavelet transformation function in matlab.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, mate.
During for wavelet anaylsis my data. I found strange point in using cwt function in matlab. When I extract [wt, f] variables using this function and plot it, however, it doesn't the same as the plot which used in cwt plot.
Here is an example in mablab, Kobe data. First one is just using that command
load kobe
cwt(kobe,1);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156974/image.png)
Last one is using that commands
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156975/image.png)
load kobe
[wt,f,coi] = cwt(kobe,1);
imagesc((1:numel(kobe))./60,f*1e3,abs(wt));
set(gca,'Ydir','normal');
xlabel('Time(mins)')
ylabel('Frequency[mHz]')
I think there are some problems in frequency output of this function. Is there any methods to revise that error?
Regards,
Minho
0 commentaires
Réponses (1)
Wayne King
le 7 Oct 2016
Hi Minho, This is because when you call CWT with no output arguments, the CWT uses a logarithmic frequency axis, it actually uses log to the base 2 as explained in the help.
"The frequency or period axis in the scalogram uses a log2 scale."
The wavelet transform most appropriately uses logarithmic scaling on the frequency axis because of the dilation property of the wavelet. So if you use a logarithmic axis
[wt,f,coi] = cwt(kobe,1);
imagesc((1:numel(kobe))./60,log2(f*1e3),abs(wt));
ax = gca;
ytick = str2num(cell2mat(ax.YTickLabel));
ax.YTickLabel = num2str(2.^ytick);
set(gca,'Ydir','normal');
xlabel('Time(mins)')
ylabel('Frequency[mHz]')
You will see it is the same. In your example, you are using a linear frequency axis. That is what accounts for the difference in what you see.
0 commentaires
Voir également
Catégories
En savoir plus sur Continuous Wavelet Transforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!