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

Try
./
Instead of
/
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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2018년 9월 9일

편집:

2018년 9월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by