how to plot both axis (X and Y axis) as log scale using code ?

조회 수: 121 (최근 30일)
Vishnu Dhakad
Vishnu Dhakad 2018년 7월 19일
편집: Vishnu Dhakad 2018년 7월 19일
I have use loglog(X, Y) but I getting an error.
  댓글 수: 2
Rik
Rik 2018년 7월 19일
That function is indeed the one you're looking for. Please post the complete error message (so all red text) and/or a piece of standalone code that we can run to reproduce the error.
Adam
Adam 2018년 7월 19일
Show the code and the error otherwise what help are you expecting to get?!

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

답변 (1개)

Constantino Carlos Reyes-Aldasoro
There are two easy ways to do this. First you can pass the values, but instead of directly the values pass their log, i.e.
plot(log(x), log(y))
The other way is through the handles
hPlot = plot(x,y);
and then modify the properties of the axes:
hPlot.xscale = 'log';
hPlot.yscale = 'log';
you can always change back to 'linear' if needed.
  댓글 수: 2
Rik
Rik 2018년 7월 19일
The loglog function will do that second automatically.
Vishnu Dhakad
Vishnu Dhakad 2018년 7월 19일
편집: Vishnu Dhakad 2018년 7월 19일
thanks for your answer
I have use
plot(X, Y);
semilogx(X, Y);
loglog(X,Y);
Now working perfectly.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by