Azzera filtri
Azzera filtri

Make Parametric Curves Plot Smoother

2 visualizzazioni (ultimi 30 giorni)
I have an application where I am hoping to plot a region inside a parametric curve, and I need the plot to be fairly close up to the curve, however this seems to have a staircasing effect on the curve. I have plotted an example below which shows the staircasing, (I have increased the line width to help the problem be visible). Is there a way to smooth this out? Refining the discretization doesn't seem to help. I understand that the curve is discrete and won't look perfect, but any suggestions are welcome!
t = linspace(0,2*pi,100);
x =cos(t) + 0.65 * cos(2 * t) -0.65; y = 1.5 * sin(t);
plot(x,y,'Linewidth',1.5)

Risposta accettata

Star Strider
Star Strider il 30 Apr 2024
I do not see any problems. The issue you are probably dealing with has to do with the finite resolution of your monitor, and the lines can only be as smooth as your monitor resolution. (Long, long ago in a galaxy far, far away, I once had to write code to plot graphics with a bed plotter with fixed step size, and dealt with this issue. It is definitely not trivial, however recent algorithms are much more efficient than the code I wrote in Applesoft BASIC in 1979 for the plotter.)
  2 Commenti
Manuel Santana
Manuel Santana il 30 Apr 2024
Thanks! Switching to a higher resolution monitor fixed the problem.
Star Strider
Star Strider il 30 Apr 2024
As always, my pleasure!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by