# How to create a series of circle by using a specific radius in cartesian?

조회 수: 2(최근 30일)
Tyann Hardyn 2021년 9월 14일
댓글: Tyann Hardyn 2021년 9월 16일
Hi, Community
I want to ask about how to create a circle series in a cartesian by using a specific radius.
Lets have this variables in Matlab :
middle_position = [-25, -25; -50, -50; -75,-75... etc] %This matrix maybe wrong because this is just an illustration
The question is, how to create a series of circles in cartesian by using a determined variable (like the above code) so we can get this kind of figure in a cartesian of matlab (plot) :
I know that it was a very simple question, but its kinda difficult for me....Would you mind to help me in finding the best code for creating the picture like above in matlab? iam so grateful if someone can help me out.
Thank you very muchh .... /.\ /.\ /.\
##### 댓글 수: 1표시숨기기 없음
darova 2021년 9월 14일
What about simple plot and for loop?

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

### 채택된 답변

Fabio Freschi 2021년 9월 14일
편집: Fabio Freschi 2021년 9월 14일
Try something like this
% anonymous function to plot a circle given the center coordinates and the
plotcircle = @(x,y,r)plot(r*cos(0:.1:2*pi)+x,r*sin(0:.1:2*pi)+y,'k');
r = 25;
% number of circles along x
nx = 5;
% number of circles along y
ny = 7;
% create figure
figure, hold on, axis equal
% loop over the circles
for i = 1:nx
for j = 1:ny
plotcircle((i-1)*2*r,(j-1)*2*r,r);
end
end
You may also want to give a try to viscircles(centers,radii) from the Image Processing Toolbox.
##### 댓글 수: 1표시숨기기 없음
Tyann Hardyn 2021년 9월 16일
Thank you very much, it help me a lot!

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

### Community Treasure Hunt

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

Start Hunting!

Translated by