function matrix = set_hex(i,j,A)

if (mod(j,2) == 0)
    A(i-1,j-1) = 1;
    A(i,j-1) = 1;

    A(i-1,j) = 1;
    A(i,j) = 1;
    A(i+1,j) = 1;

    A(i-1,j+1) = 1;
    A(i,j+1) = 1;
else
    A(i,j-1) = 1;
    A(i+1,j-1) = 1;

    A(i-1,j) = 1;
    A(i,j) = 1;
    A(i+1,j) = 1;

    A(i,j+1) = 1;
    A(i+1,j+1) = 1;
end

matrix = A;