%% 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 日

0 投票

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 月 18 日
Thank you so much! It fixed my graph, but if I needed the x axis to be labeled from -15, to 15, how can I do that without breaking my code?
Star Strider
Star Strider 2020 年 9 月 19 日
use xlim rather than axis:
xlim([-15 15])
.
Serena Simpson
Serena Simpson 2020 年 9 月 19 日
It worked great! Thanks!
Star Strider
Star Strider 2020 年 9 月 19 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-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