Wavelet plotting with imagesc

조회 수: 7 (최근 30일)
Nikolas
Nikolas 2016년 7월 27일
답변: Nikolas 2016년 7월 27일
Dear all, I am trying to plot the results of wavelet decomposition using imagesc and unfortunately this is not working properly.
The plot is perfect using surf, but the plot returned with this command is too heavy (and consequently slow) to manipulate (zoom in/out), so I need to do this with imagesc.
The code I am using is the following:
%Example 5s long signal
sr = 1000;
t = linspace(0,5,5*sr);
sig = 2*cos(2*pi*100*t).*(t<0.500)+3*cos(2*pi*300*t).* (t>0.500 & t <1)+randn(size(t));
WaveletName='cmor2-1';
fc = centfrq(WaveletName);
freqrange = [10 300];
scalerange = fc./(freqrange*(1/sr));
scales = scalerange(end):1:scalerange(1);
Coeffs = cwt(sig,scales,WaveletName);
F = scal2frq(scales,WaveletName,1/sr);
figure;
subplot(1,2,1);
surf(t,F,abs(Coeffs),'EdgeColor','none'); view(2); colorbar; title('Surf');
subplot(1,2,2);
imagesc(t,F,abs(Coeffs)); axis xy; colorbar; title('Imagesc');
Below an example of the resulting plots
Any ideas on how to get imagesc to plot the same thing as surf?

채택된 답변

Nikolas
Nikolas 2016년 7월 27일
I finally found the solution.
The issue is that imagesc doesn't accept non-linear axes as input.
Using instead the function uimagesc from FileExchange does the trick and it is as fast as the native imagesc.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Wavelet Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by