set x-axis in semilogx plot

조회 수: 11 (최근 30일)
Senne Van Minnebruggen
Senne Van Minnebruggen 2020년 5월 26일
댓글: Senne Van Minnebruggen 2020년 5월 26일
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])
Senne Van Minnebruggen
Senne Van Minnebruggen 2020년 5월 26일
thanks

댓글을 달려면 로그인하십시오.

답변 (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