Linear equation of circle
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ANDREAS KOUNTOURIS
le 12 Fév 2022
Commenté : ANDREAS KOUNTOURIS
le 15 Fév 2022
Hello, consider having a general equation of circle like x^2+y^2=r^2.
A way to linear the circle is to "cut the circle into horizintal or vertical slices". Any idea how could I transfer this idea in matlab equations?
Thank you.
6 commentaires
Voss
le 12 Fév 2022
Plotting in polar coordinates would allow you to plot a circle while avoiding non-linear terms:
t = 0:0.01:2*pi;
polarplot(t,ones(size(t)),'LineWidth',2);
Réponse acceptée
DGM
le 12 Fév 2022
Modifié(e) : DGM
le 12 Fév 2022
You mean like this?
r = 1;
y = linspace(-r,r,50);
xr = sqrt(r^2 - y.^2);
xl = -sqrt(r^2 - y.^2);
plot([xr; xl],[y; y])
And I suppose you could rotate it if you wanted
r = 1;
t = 30;
y = linspace(-r,r,50);
xr = sqrt(r^2 - y.^2);
xl = -sqrt(r^2 - y.^2);
[th rh] = cart2pol([xr; xl],[y; y]);
[xx yy] = pol2cart(th+t*pi/180,rh);
plot(xx,yy)
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



