Hi. I'm trying to plot a polynomial function but I'm not getting the desired output. Can you tell me what I'm doing wrong?
조회 수: 1 (최근 30일)
이전 댓글 표시
The original question is: and I need to plot it over an interval of (-2:1). My code is :
and my output is:
whereas my desired output is:
I'm not sure what I'm doing wrong
댓글 수: 3
John D'Errico
2021년 9월 27일
편집: John D'Errico
2021년 9월 27일
Of course, what @William Rose said SHOULD have been an answer. I can't rectify that, not yet at least. :)
See that what you did was to plot FOUR points on that curve, then connected by default with straight lines. You want to plot a zillion points on that curve, so use what was suggested to you by @William Rose.
답변 (1개)
William Rose
2021년 9월 27일
replace
x=-2:1;
with
x=-2:.01:1;
to get a step size of .01, instead of a step size of 1.
Good luck!
댓글 수: 2
John D'Errico
2021년 9월 27일
편집: John D'Errico
2021년 9월 27일
@Zainab Waqar: Please accept this answer if it helped you. That gives rep to the responder.
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!