Wavelet plotting with imagesc

8 views (last 30 days)
Nikolas
Nikolas on 27 Jul 2016
Answered: Nikolas on 27 Jul 2016
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?

Accepted Answer

Nikolas
Nikolas on 27 Jul 2016
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.

More Answers (0)

Categories

Find more on Wavelet Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!