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.

 Akzeptierte Antwort

Star Strider
Star Strider am 3 Dez. 2016

3 Stimmen

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

Weitere Antworten (2)

Richard Kadar-Nemeth
Richard Kadar-Nemeth am 3 Dez. 2016

0 Stimmen

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 Kommentar

Star Strider
Star Strider am 3 Dez. 2016
My pleasure.
Leaving a space between the dot and the operator will throw an ‘Unexpected MATLAB operator.’ error.

Melden Sie sich an, um zu kommentieren.

Bhargav k
Bhargav k am 8 Okt. 2020

0 Stimmen

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

Kategorien

Mehr zu Line Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by