How to draw equally sized squares

조회 수: 1 (최근 30일)
Mekala balaji
Mekala balaji . 2019년 4월 19일
댓글: Mekala balaji . 2019년 4월 21일
Hi,
I draw a circle of radius 1, and I want to draw eqaully sized squares in the background of the circle. Kindly some one help,
r = 1. 0;
th = linspace(0,2*pi) ;
x = r*cos(th) ;
y = r*sin(th) ;
patch(x,y,rand(1,3)) ; % I am using random color in patch here.
axis equal
Now I want draw 10x10 squares as a background to the circle (the dia of each square is (2*r/10)).

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 4월 19일
편집: KALYAN ACHARJYA 님. 2019년 4월 19일
x=[-1, 1, 1, -1, -1];
y=[-1, -1, 1, 1, -1];
plot(x, y, 'r-');
fill(x,y,'b')
hold on;
r=1.0;
th=linspace(0,2*pi) ;
x=r*cos(th) ;
y=r*sin(th) ;
patch(x,y,rand(1,3)) ; % I am using random color in patch here.
axis equal
66.png
  댓글 수: 3
Mekala balaji
Mekala balaji 2019년 4월 21일
I need to define 10 times the co-ordinates

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by