So far I've got:
x = [-100 : 1 : 100];
y = (x - 2) / (2*x + 3);
plot(x,y, 'r')
grid on, axis equal
When I run it, it brings up the plot but the graph is missing.

 採用された回答

Star Strider
Star Strider 2016 年 12 月 3 日

3 投票

You forgot the dot (.) operator to do element-wise division:
y = (x - 2) ./ (2*x + 3);
↑ ← DOT GOES HERE!

その他の回答 (2 件)

Richard Kadar-Nemeth
Richard Kadar-Nemeth 2016 年 12 月 3 日

0 投票

Oh yes, the dot. I was playing with it but left a space between the dot and the / operator. Thanks for the quick help.

1 件のコメント

Star Strider
Star Strider 2016 年 12 月 3 日
My pleasure.
Leaving a space between the dot and the operator will throw an ‘Unexpected MATLAB operator.’ error.

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

Bhargav k
Bhargav k 2020 年 10 月 8 日

0 投票

Plot the graph of y = x^2 − 2x − 3.

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by