Why won't this plot?

1 visualización (últimos 30 días)
Serena Simpson
Serena Simpson el 18 de Sept. de 2020
Comentada: Star Strider el 19 de Sept. de 2020
%% 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 comentarios
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 18 de Sept. de 2020
First, use more points:
x = -4:.1:-1;
Then remove the axis limil:
% axis([-15 15 0 15])
Serena Simpson
Serena Simpson el 18 de Sept. de 2020
Thank you so much!

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 18 de Sept. de 2020
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 comentarios
Serena Simpson
Serena Simpson el 19 de Sept. de 2020
It worked great! Thanks!
Star Strider
Star Strider el 19 de Sept. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by