Why isn't my graph plotting?

9 ビュー (過去 30 日間)
Anna Byrnes
Anna Byrnes 2021 年 8 月 8 日
コメント済み: Star Strider 2021 年 8 月 8 日
This was my input code:
x = [0:0.25:5];
y = exp(x)/(exp(x)-1);
plot(x,y)
And when I run it it just comes up with a blank set of axes with no actual graph on it, not really sure why this is so any help would be appreciated!

採用された回答

Star Strider
Star Strider 2021 年 8 月 8 日
That is because using matrix right division (/) it is plotting onlly one point, and while this would work if it also plots markers, will not work to plot lines, that require at least two points in order to draw a line between them.
Using element-wise division (./) creates the necessary vector and draws the plot —
x = [0:0.25:5];
y = exp(x)./(exp(x)-1);
% ↑ ← HERE
plot(x,y)
.
  2 件のコメント
Anna Byrnes
Anna Byrnes 2021 年 8 月 8 日
Thanks so much!
Star Strider
Star Strider 2021 年 8 月 8 日
As always, my pleasure!
.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by