How to draw circle with radius 1 ?

조회 수: 5 (최근 30일)
Eman S
Eman S 2017년 10월 26일
편집: Eman S 2020년 2월 1일
My question is:
how to draw circle with radius 1 ?

채택된 답변

KSSV
KSSV 2017년 10월 27일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by