MATLAB: How to draw circle with radius 1

My question is:
how to draw circle with radius 1 ?

Best Answer

Rad3Over2 = sqrt(3) / 2;
[X Y] = meshgrid(-.2:0.2:1.6);
n = size(X,1);
X = Rad3Over2 * X;
Y = Y + repmat([0 0.5],[n,n/2]);
% Plot the hexagonal mesh, including cell borders
[XV, YV] = voronoi(X(:),Y(:));
plot(XV,YV,'b')
axis equal,
axis([.2 1.2 .2 1])
zoom on ;
hold on
%%Get centers
[V,C] = voronoin([X(:) Y(:)]) ;
xc = cellfun(@(index) mean(V(index,1)),C);
yc = cellfun(@(index) mean(V(index,2)),C);
%%draw circles
th = linspace(0,2*pi) ; r = 0.1 ;
x = r*cos(th) ; y = r*sin(th) ;
for i = 1:length(xc)
if ~isinf(xc(i))
xx = x+xc(i) ;
yy = y+yc(i) ;
plot(xx,yy,'r')
end
end