Error is code given in documentation: The coordinate system or ruler class does not support log axis scale.
3 views (last 30 days)
Show older comments
Hello,
I am new in MatLab and I need some help to fix a bit of code. I have tried a few suggestions but still does not work.
The issue is that I try to convert axis to logarithmic:
Here is the code (link: https://uk.mathworks.com/help/wavelet/ug/boundary-effects-and-the-cone-of-influence.html, go down to appendix)
The parameters are obtained using [cfs, f, coi] = cwt(signal,'amor',seconds(1/Fs));
Thank you in advance
function varargout = helperPlotScalogram(f,cfs,coi)
nargoutchk(0,1);
ax = newplot;
surf(ax,1:3000,f,abs(cfs),'EdgeColor','none')
ax.YScale = 'log';
%set(gca=ax, 'YScale', 'log')
clim([0.01 1])
colorbar
grid on
ax.YLim = [min(f) max(f)];
ax.XLim = [1 size(cfs,2)];
view(0,90);
xlabel('Time');
ylabel('Cycles/Sample')
if nargin == 3
hl = line(ax,1:3000,coi,ones(3000,1));
hl.Color = 'k';
hl.LineWidth = 2;
end
if nargout > 0
varargout{1} = ax;
end
end
0 Comments
Answers (1)
Navya Singam
on 23 Nov 2022
Hi,
The command newplot creates a new plot and the axis can be converted into logaithmic scale by using the command ax.YScale = 'log'
ax = newplot;
ax.YScale = 'log';
(or)
gca returns the current axes and axes scales can be set using the set command.
set(gca, 'YScale', 'log')
You can refer to the rulers section in https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.html to understand how to change the axes scales.
0 Comments
See Also
Categories
Find more on Continuous Wavelet Transforms 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!