Why doesn't my plot "go to infitnity"?

5 ビュー (過去 30 日間)
Jake
Jake 2023 年 1 月 19 日
編集済み: Torsten 2023 年 1 月 19 日
Probably a silly question, but I couldn't figure out the reason! I have,
x = [0.00,0.10,0.19,0.29,0.38,0.48,0.58,0.67,0.77,0.86,0.96,1.06,1.15,1.25,1.34,...
1.44,1.54,1.63,1.73,1.82,1.92,2.02,2.11,2.21,2.30,2.40,2.50,2.59,2.69,2.78,2.88,4.80];
y = [-inf,-0.03,-0.01,0.01,0.03,0.04,0.06,0.07,0.09,0.10,0.11,0.11,0.12,0.12,0.13,0.13,0.13,0.13,0.12,...
0.12,0.12,0.11,0.10,0.10,0.09,0.08,0.07,0.07,0.06,0.06,0.05,0.00];
plot(x,y)
Why doesn't the plot go to infinity?

回答 (1 件)

Torsten
Torsten 2023 年 1 月 19 日
移動済み: Torsten 2023 年 1 月 19 日
What finite y value do you want -inf to be in the plot ?
Since nobody knows, MATLAB just skips these data points (same for NaN values).
  2 件のコメント
Jake
Jake 2023 年 1 月 19 日
"MATLAB just skips these data points (same for NaN values)." I didn't think of that!
But what if there is no finite y value at y(1,1) - Like, 0/0 ? Is there a way to make the plot with, say, an exponential line? O.o
Torsten
Torsten 2023 年 1 月 19 日
編集済み: Torsten 2023 年 1 月 19 日
Choose additional points near x=0 and evaluate y for these points. This will show the trend for y.
x = 0.001:0.001:1;
y = 1./x;
plot(x,y)

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by