set x-axis in semilogx plot

10 次查看(过去 30 天)
I'm tring to plot a graph with a logaritmic x-axis. I want the x-axis to go from zero to 10000.
However when i try the following code nothing happens. (result see attachment)
x = [10 100 2000 3400 5000];
y = [12 8 5 3 2];
semilogx(x,y);
xt = [0 1 10 100 1000 10000];
set(gca,'XTick',xt)
xlim([0 100000])
ylim([0 15])
How can i solve this?
  2 个评论
William Alberg
William Alberg 2020-5-26
You cannot reach 0 on a logarithmic plot.
You can do the following:
x = [10 100 2000 3400 5000];
y = [12 8 5 3 2];
semilogx(x,y);
% xt = [0.1 1 10 100 1000 10000];
% set(gca,'XTick',xt)
xlim([0.1 100000])
ylim([1 15])

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by