Why won't this plot?

조회 수: 2 (최근 30일)
Serena Simpson
Serena Simpson 2020년 9월 18일
댓글: Star Strider 2020년 9월 19일
%% Section 1: Initalization of Variables
%increments of x
x = -4:1:-1;
%
%The function we are given
y = x + (1 ./ (x.^2-1));
%% Section 2: Processing
plot(x,y)
axis([-15 15 0 15])
%I want to be able to see the y function appraching the verticle asymptote '-1' from the left but my function wont graph
  댓글 수: 2
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 18일
First, use more points:
x = -4:.1:-1;
Then remove the axis limil:
% axis([-15 15 0 15])
Serena Simpson
Serena Simpson 2020년 9월 18일
Thank you so much!

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

채택된 답변

Star Strider
Star Strider 2020년 9월 18일
The problem are the y-axis limits in the axis call.
Comment-out the axis call (as I do here) and you will immediately see the problem.
plot(x,y)
% axis([-15 15 0 15])
.
  댓글 수: 4
Serena Simpson
Serena Simpson 2020년 9월 19일
It worked great! Thanks!
Star Strider
Star Strider 2020년 9월 19일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by