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 Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2016년 12월 3일

답변:

2020년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by