print a circular disk onto my graph
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Viktor Edlund
am 15 Apr. 2019
Bearbeitet: Adam Danz
am 17 Apr. 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 Kommentare
Akzeptierte Antwort
Adam Danz
am 15 Apr. 2019
Bearbeitet: Adam Danz
am 17 Apr. 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
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!