MATLAB: How to plot (n) circles with known center and radius

circlesplot

Hi,
I need to generat a plot of (n) circles. The radius of the circles is known and equals to 15m. The circles centers are separated by azimuthal angle equal to 10 degrees and they are located on the perimiter of biggr circle that it is radius is 120m.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
theta=10 % azimuthal distance between the centers of circles group
r=120 % The radius of the big circle
DM=12 % The radius of the group of circles
for i=1:38 % number of circles
x1(i)= r*cosd(90-(i-1)*theta); % the x comoenets of the circle group
y1(i)=r*sind(90-(i-1)*theta); % The y component of the circle group
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Would please advise.
Best Regards,

Best Answer

If you have the Image Processing Toolbox, use viscircles(centers, radii):
theta=10 % azimuthal distance between the centers of circles group
r=120 % The radius of the big circle
DM=12 % The radius of the group of circles
numCircles = 38;
for k = 1 : numCircles % number of circles
xCenter(k) = r * cosd(90-(k-1)*theta); % the x comoenets of the circle group
yCenter(k) = r * sind(90-(k-1)*theta); % The y component of the circle group
end
plot(xCenter, yCenter, 'b.');
grid on;
viscircles([xCenter(:),yCenter(:)], 15 * ones(numCircles, 1));
axis square