How to replicate a hexagon pattern in a given area of 100x100
8 views (last 30 days)
I need the guidance from experts as I am little bit confused about how to replicate this hexagon pattern as shown in Figure in an area of 100x100. Because I am not getting how to apply for loop in height and width so that I can get a pattern of hexagons in 100x100.
Need your guidance. My code can be found in attached Replicating_cell_layout1.m file.
I will be thankful for your kind and urgent reply.
Rick Rosson on 5 Dec 2015
Edited: Rick Rosson on 5 Dec 2015
r = 2;
dx = r;
dy = r*sin(pi/3);
for x = 0:dx:100
for y = 0:dy:100
aHex = new_hexagon([x y],r);
function aHex = new_hexagon(center,radius)
N = 6;
phi = (2*pi/N)*(0:N)';
aHex = ones(N+1,1)*center + radius * [ cos(phi) sin(phi) ];