print a circular disk onto my graph
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Viktor Edlund
le 15 Avr 2019
Modifié(e) : Adam Danz
le 17 Avr 2019
Hi! I now work in a project to simulate the solarsystem on a very simple level. The assingment is to plot the path of orbit of the planets and to plot a sketched sun in the center. It feels like a simple thing but i cant manage to figure out how to do it. are there any comands that can plot circles or discs? it should symbolize the sun so it has to be filled. Any suggestions?
Im looking forward for answers.
Kind regards, Viktor
0 commentaires
Réponse acceptée
Adam Danz
le 15 Avr 2019
Modifié(e) : Adam Danz
le 17 Avr 2019
Ironically, you can use the rectangle() function with 100% curvature to plot a circle.
The position property specifies the lower, left corner of the rectangle, not the center of it, along with the width and height (in this case, diameter). So if you'd like your circle centered at (0,0) with a diameter of 10, you'll need to subtract 10/2 from (0,0) in order to specify the lower, left "corner" of the rectangle.
Be sure to set axes to 'equal' so the aspect ratio depicts a circle.
center = [0,0];
diameter = 10;
figure
h = rectangle('Position',[center-diameter/2, diameter, diameter],'Curvature',[1,1], 'FaceColor', 'y', 'EdgeColor', 'k');
axis equal
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!