Effacer les filtres
Effacer les filtres

Make Parametric Curves Plot Smoother

3 vues (au cours des 30 derniers jours)
Manuel Santana
Manuel Santana le 29 Avr 2024
Commenté : Star Strider le 30 Avr 2024
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)

Réponse acceptée

Star Strider
Star Strider le 30 Avr 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 commentaires
Manuel Santana
Manuel Santana le 30 Avr 2024
Thanks! Switching to a higher resolution monitor fixed the problem.
Star Strider
Star Strider le 30 Avr 2024
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by