Draw circle in a rectangular
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hussein Haider
am 17 Jan. 2023
Kommentiert: Hussein Haider
am 18 Jan. 2023
How to draw a Matlab code that draws a red circle with radius 1 at the center of a green square of sides 20. The square borders should be blue.
0 Kommentare
Akzeptierte Antwort
Matt J
am 17 Jan. 2023
Bearbeitet: Matt J
am 18 Jan. 2023
s=([0 0 ; 0 1; 1 1; 1 0]-1/2)*20;
t=linspace(0,360,1000)';
c=[cosd(t), sind(t)];
patch('XData',s(:,1),'YData',s(:,2),'FaceColor','g','EdgeColor','b','LineWidth',3);
patch('XData',c(:,1),'YData',c(:,2),'FaceColor','r','LineStyle','none');
axis equal
2 Kommentare
Weitere Antworten (2)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


