Inaccuracy in a loglog(...) plot, compared to a standard plot(...)

5 ビュー (過去 30 日間)
Adam Wisam
Adam Wisam 2020 年 9 月 27 日
コメント済み: Adam Wisam 2020 年 9 月 27 日
Hello,
I have this wierd problem, or I might just be missing something. I have 2 points and I'm trying to interpolate linearly between them. I used a very simple linear interpolation formula, and got the result 2.3672... I confirmed this using an online calculator. However, when plotting the intersection using loglog(...) it seems that the result is around 2.3686... Plotting using the standard plot(...) gives the first, calculated, result. When reading the values of the graphs im zooming very far in, so there is no chance that I misread the values.
I could post the code, but I think the answer has something to do with Matlab's behaviour and not my code. Also I tried using set(gca, 'XScale', 'log', 'YScale', 'log') instead of loglog, still the same results.

採用された回答

David Goodmanson
David Goodmanson 2020 年 9 月 27 日
編集済み: David Goodmanson 2020 年 9 月 27 日
HI Adam,
I am assuming that you are doing something like
x = [1 2]
y = [2,3]
plot(x,y)
and then zooming in on the plot at, say, x = 1.6 to find finding the result y = 2.6. Doing the same thing on a loglog plog gives y = 2.63. But this is not inaccuracy, it's just a different situation. The regular plot draws the straight line y = a + b*x, but the loglog plot draws straight lines in log, so the line is log10(y) = a + b*log10(x) which is a different functional dependence of y on x. So you get a different answer.
  1 件のコメント
Adam Wisam
Adam Wisam 2020 年 9 月 27 日
I understand, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by