フィルターのクリア

Reason for line not plotting?

1 回表示 (過去 30 日間)
1582251394
1582251394 2018 年 9 月 9 日
編集済み: madhan ravi 2018 年 9 月 9 日
x = 1:10:100;
y = (((20*x+35000)/(70))-1)/x;
plot(x,y)
I was wondering why the above code does not plot the function, y? As soon as the x is put in the denominator the function refuses to plot.
  2 件のコメント
jonas
jonas 2018 年 9 月 9 日
Try
./
Instead of
/
Stephen23
Stephen23 2018 年 9 月 9 日
y = (((20*x+35000)/(70))-1)./x;
^^ you need this!
You need to learn about array and matrix operations:

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

採用された回答

madhan ravi
madhan ravi 2018 年 9 月 9 日
編集済み: madhan ravi 2018 年 9 月 9 日
Use element wise operation because as you defined x as a vector you should use dot it means each element is calculated one by one.
x = 1:10:100;
y = (((20*x+35000)/(70))-1)./x;
plot(x,y)
  1 件のコメント
madhan ravi
madhan ravi 2018 年 9 月 9 日
編集済み: madhan ravi 2018 年 9 月 9 日
if it solved the issue, please accept the answer

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by