Error is code given in documentation: The coordinate system or ruler class does not support log axis scale.

조회 수: 7 (최근 30일)
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:
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

답변 (1개)

Navya Singam
Navya Singam 2022년 11월 23일
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.

카테고리

Help CenterFile Exchange에서 Speech Recognition에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by