I'm trying to use voronoin() as part of a larger function to determine the nearest neighbors of experimental points within a system. I made an ideal system of points to test it and the output, using:
clear allk=1; while k<=400 %this is the value of n*i and the total number of points in the system
for n = 1:20for i = 1:20a(:,k) = [8*rand*n;8*rand*i]; %randomness is to introduce uneven spacing, but removing rand changes nothing
k = k+1;endendendw=voronoin(a);
However, I consistently get the error message:
Error using cgprechecks (line 40)Not enough unique points specified.Error in voronoin (line 58)cgprechecks(x, nargin, cg_opt);
This is consistent regardless of how many points I generate (have tested for up to k = 40000).
Could someone explain why this error occurs? Is voronoin() unable to process systems with somewhat square symmetry? Thanks!
Best Answer