How changing the loglog scale x and y axis?

14 次查看(过去 30 天)
I need to represent numbers from 0.5 to 50 (0.5 5 50) instead of 1 10 100(standard log log scale) is it possible? how can i do?

采纳的回答

Walter Roberson
Walter Roberson 2017-10-3
x = sort( rand(1,40)*49.5 + 0.5 );
y = x.*abs(sin(x));
loglog(x,y)
xlim([0.5 50])
ylim([0.5 50])
nticks = 5;
tickpos = round( logspace(log10(0.5),log10(50), nticks) );
set(gca, 'XTick', tickpos, 'YTick', tickpos)
  2 个评论
Emrys
Emrys 2017-10-3
Thanks for the answer Mr Roberson, but i still have the problem, the way you suggest me doesn't change the scale, what i meant it was that i need to use decade from 0.5 to 5 and 5 to 50. It's like setting the origin in 0.5 instead of 1.
Walter Roberson
Walter Roberson 2017-10-3
tickpos = [0.5 5 50];
set(gca, 'XTick', tickpos, 'YTick', tickpos)

请先登录,再进行评论。

更多回答(1 个)

David J. Mack
David J. Mack 2017-10-3
编辑:David J. Mack 2017-10-3
Have you tried to use semilogy instead of loglog, e.g.:
semilogy(x,y);
If you have to use loglog, use the 'XScale'-Property instead:
loglog(x,y);
set(gca,'XScale','linear');
In both cases you can set the x-tick & the x-axis limit, using:
set(gca, 'XTick',[0.5 5:5:50], 'XLim',[0.5 50]);
Greetings, David

类别

Help CenterFile Exchange 中查找有关 Red 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by