Code covered by the BSD License  

Highlights from
Estimating the number of clusters via System Evolution

from Estimating the number of clusters via System Evolution by Kaijun Wang
estimate number of clusters for far clusters, small-larger clusters, slightly overlapping clusters

regionF_find(Dmatrix,A1,B1,distA1,distB1,k)
function [Ra,Rb] = regionF_find(Dmatrix,A1,B1,distA1,distB1,k)

nA = length(A1);
nB = length(B1);
k1 = min([fix(2*(distA1/distB1-1))/10 0.3]);
k2 = min([fix(2*(distB1/distA1-1))/10 0.3]);
if  k1 > 0.1
   ka = k+k1;
   kb = k-k1;
elseif k2 > 0.1
   kb = k+k2;
   ka = k-k2;
else
   ka = k;
   kb = k;
end

na = round(ka*nA);
nb = round(kb*nB);
if na >= nA
   Ra = A1;
else
   Ra = border_points(Dmatrix,A1,B1,na);
end
if nb >= nB
   Rb = B1;
else
   Rb = border_points(Dmatrix,B1,A1,nb);
end

Contact us at files@mathworks.com