필터 지우기
필터 지우기

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 CenterFile Exchange에서 2-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