MATLAB Answers

Some bugs(?) in cwt, continuous wavelet transformation function in matlab.

조회 수: 9(최근 30일)
Minho Kim
Minho Kim 7 Oct 2016
Answered: Wayne King 7 Oct 2016
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);
Last one is using that commands
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

로그인 to comment.

답변 수 (1)

Wayne King
Wayne King 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

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by