Borrar filtros
Borrar filtros

Removing Plot's Asymptote

10 visualizaciones (últimos 30 días)
Elvin
Elvin el 31 de Dic. de 2012
Can you help why and how to remove the asymptotes that this code is producing in the graph? Here's my code:
f = @(x)tan(x)-x-1;
r1 = fsolve(f,-7);
r2 = fsolve(f,1);
r3 = fsolve(f,7);
root1 = char(vpa(r1,6));
root2 = char(vpa(r2,6));
root3 = char(vpa(r3,6));
fprintf('The roots are %s, %s, and %s. \n',root1,root2,root3)
x = -10:0.0001:10;
y = f(x);
plot(x,y), hold on, grid on
plot(r1,0,'rx','LineWidth',2,'MarkerSize',12);
plot(r2,0,'rx','LineWidth',2,'MarkerSize',12);
plot(r3,0,'rx','LineWidth',2,'MarkerSize',12);
title('The graph of tan(x) - x - 1','FontSize',13)
axis([-10,10,-10,10])
Thank you very much.

Respuesta aceptada

Matt J
Matt J el 31 de Dic. de 2012
Don't plot a single curve over x = -10:0.0001:10
Generate and plot separate x,y loci in the intervals (e.g., [-pi/2,pi/2]) between the asymptotes.
  1 comentario
Elvin
Elvin el 31 de Dic. de 2012
Thanks for that. I'll try that. I'm still not good in MATLAB.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D 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