How to draw circle with radius 1 ?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
My question is:
how to draw circle with radius 1 ?
0 Kommentare
Akzeptierte Antwort
KSSV
am 27 Okt. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!