How to display smooth (high definition) curves with plot?

4 visualizaciones (últimos 30 días)
Pedro Delcorral
Pedro Delcorral el 7 de Mzo. de 2017
Editada: Jan el 7 de Mzo. de 2017
This question concerns only the way a curve is displayed on the screen with plot(x,y), not the data. For example:
x=linspace(0,50,1000000);
plot(x,sin(x))
Displays the following plot:
And I would like to have something like this:
Notice that in the second graph, the curve is much smoother. The amount of data points is not the problem here, since we have 1000000 (one million) points. Also, I'm looking for a way to display it, not to export into an image file since after plotting it, I use getframe to copy the figure displayed and create a movie.
I have tried setting the figure property Renderer to painters, zbuffer and OpenGL, and none of them work.
Thank you

Respuesta aceptada

Jan
Jan el 7 de Mzo. de 2017
Editada: Jan el 7 de Mzo. de 2017
A million data points is very much for this tiny image, which does not have 1 million pixels.
Please try (i cannot do this currently):
x = linspace(0, 50, 1000);
plot(x, sin(x), 'LineSmoothing', 'on');
If this does not work, there might be a problem with the OpenGL renderer. See https://www.mathworks.com/matlabcentral/answers/157696-line-smoothing-in-matlab2014b.

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