Hi. I'm trying to plot a polynomial function but I'm not getting the desired output. Can you tell me what I'm doing wrong?

1 visualización (últimos 30 días)
The original question is: and I need to plot it over an interval of (-2:1). My code is :
and my output is:
whereas my desired output is:
I'm not sure what I'm doing wrong
  3 comentarios
John D'Errico
John D'Errico el 27 de Sept. de 2021
Editada: John D'Errico el 27 de Sept. de 2021
Of course, what @William Rose said SHOULD have been an answer. I can't rectify that, not yet at least. :)
See that what you did was to plot FOUR points on that curve, then connected by default with straight lines. You want to plot a zillion points on that curve, so use what was suggested to you by @William Rose.

Iniciar sesión para comentar.

Respuestas (1)

William Rose
William Rose el 27 de Sept. de 2021
replace
x=-2:1;
with
x=-2:.01:1;
to get a step size of .01, instead of a step size of 1.
Good luck!

Categorías

Más información sobre Graphics Performance 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