log-log plot explained

조회 수: 10 (최근 30일)
jojo
jojo 2020년 2월 23일
편집: dpb 2020년 2월 23일
How can do we produce a log-log visualization for the following data set?
y=[0.6280 0.6554 0.6760 0.6877];
x=[0.27 0.14 0.07 0.04];
figure(1)
loglog(x,y)
An explanation would be great too. Thanks

채택된 답변

dpb
dpb 2020년 2월 23일
편집: dpb 2020년 2월 23일
You have created such...what's the problem?
Probably the issue is that your data don't cover a sufficient range in either x or y that the effect of a logarithmic axis is obvious; there is really not much point in using log axes unless data cover many orders of magnitude; otherwise just linear is clearer.
The only possible reason I can think of for such with data such as you've given would be if there were known to be some reason the two are somehow expected to be related by such...but you've given zero context so that's purely conjecture.
If you change the x-,y-limits from the very narrow range that are the default autoscaling, perhaps the nature of the logarithmic axes will be more apparent--
xlim([0.01 1])
ylim([0.4 1])
results in
Oh! One other thing...given that you've given the x data in decreasing order and ML will always plot by default the axes in increasing order, maybe you'd prefer
hAx=gca;
hAx.XDir='reverse';
that will put the larger values to the left instead of right.
  댓글 수: 1
Stephen23
Stephen23 2020년 2월 23일
jojo's "Answer" moved here:
The data is error (y) vs grid size(x). On my figure, I did not see the log scale populate properly. But that's due to lack of data points as you explained. I was just curious of a better way.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by