log-log plot explained

6 次查看(过去 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 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by