Incorrect plot domain when using linspace

1 visualización (últimos 30 días)
Aleem Andrew
Aleem Andrew el 25 de Sept. de 2020
Comentada: Aleem Andrew el 25 de Sept. de 2020
The plot generated by the following code should have a domain from 0 to 5 but instead each x value is multiplied by a factor of 20, for example, the y value at x = 100 (in the Matlab plot) is actually the y value at x = 5. I am using Matlab R2018a. Does anyone have suggestions as to how this problem can be fixed?
x = linspace(0,5);
y = 7/6*(x).^-1.*(x>0)-1.5*(x).^0.*(x>0) + 0.5*(x).^1.*(x>0);

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Sept. de 2020
Editada: KALYAN ACHARJYA el 25 de Sept. de 2020
plot(x,y);
if
plot(y);
  1 comentario
Aleem Andrew
Aleem Andrew el 25 de Sept. de 2020
Thanks for your answer I thought maybe the domain was implicit in the y function

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.

Community Treasure Hunt

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

Start Hunting!

Translated by