MATLAB Answers

figure - plot, semilogx, loglog, ...

3 ビュー (過去 30 日間)
Robin L.
Robin L. 2019 年 6 月 12 日
回答済み: Jesús Zambrano 2019 年 8 月 4 日
Hello,
A small question for you today :
% let us take x, y, some random values (> 0)
Are the following codes the same ?
plot(x, y);
set(gca, 'XScale', 'log');
and
semilogx(x, y);
?
plot(x, y);
set(gca, 'XScale', 'log');
set(gca, 'YScale', 'log');
and
loglog(x, y);
?
And so on...
If true, finally, what is the best pratice ?
Thanks !
Robin

  0 件のコメント

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

回答 (1 件)

Jesús Zambrano
Jesús Zambrano 2019 年 8 月 4 日
Hi Robin,
Indeed, those codes give the same results.
If you know in advance that your plot should have one or both axes in log scale, I recommend you to use the semilogx or loglog commands: the execution time (if you have many data to be plotted in many figures) will be shorter, and your script will have less lines.
Best,
Jesús

  0 件のコメント

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by