Incorrect plot domain when using linspace

조회 수: 2 (최근 30일)
Aleem Andrew
Aleem Andrew 2020년 9월 25일
댓글: Aleem Andrew 2020년 9월 25일
The plot generated by the following code should have a domain from 0 to 5 but instead each x value is multiplied by a factor of 20, for example, the y value at x = 100 (in the Matlab plot) is actually the y value at x = 5. I am using Matlab R2018a. Does anyone have suggestions as to how this problem can be fixed?
x = linspace(0,5);
y = 7/6*(x).^-1.*(x>0)-1.5*(x).^0.*(x>0) + 0.5*(x).^1.*(x>0);

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 9월 25일
편집: KALYAN ACHARJYA 2020년 9월 25일
plot(x,y);
if
plot(y);
  댓글 수: 1
Aleem Andrew
Aleem Andrew 2020년 9월 25일
Thanks for your answer I thought maybe the domain was implicit in the y function

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by