how can i plot multiple circles in a plot

조회 수: 3 (최근 30일)
Borison ningthoujam
Borison ningthoujam 2018년 6월 12일
답변: Anton Semechko 2018년 6월 12일
i tried using the code below but they all draw ellipse i want perfect circle not ellipse type
if true
s=[7,7];
d=[0,-4];
c=[5,5];
ox = -10 + (20)*rand(10,1);
oy = -10 + (20)*rand(10,1);
hold on
for l=1:length(ox)
viscircles( [ox(l), oy(l)], 1,'LineStyle','-','LineWidth',1);
end
end

답변 (1개)

Anton Semechko
Anton Semechko 2018년 6월 12일
After you finished plotting, use command
axis equal
to make aspect ratios of vertical and horizontal axes equal to one another.
So your code would be
s=[7,7];
d=[0,-4];
c=[5,5];
ox = -10 + (20)*rand(10,1);
oy = -10 + (20)*rand(10,1);
hold on
for l=1:length(ox)
viscircles( [ox(l), oy(l)], 1,'LineStyle','-','LineWidth',1);
end
axis equal

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by