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

remove_outlier(Dmatrix,A1,nA)
function [Ra,Rc,Dmatrix] = remove_outlier(Dmatrix,A1,nA)

na = min([round(0.1*nA) 3]);
Dsub = Dmatrix(A1,A1);
[Dsub,Rc] = sort(-sum(Dsub)/(nA-1));
Dsub = -Dsub;
cut = find(Dsub(1:na) > 1.5*median(Dsub));
if length(cut) > 0
   cut = A1(Rc(cut));
   Dmatrix(cut,:) = 0.75*Dmatrix(cut,:);
   Dmatrix(:,cut) = 0.75*Dmatrix(:,cut);
end
cut = find(Dsub(1:na) > 2*median(Dsub));
if length(cut) > 0
   Rc = A1(Rc(cut));
else
   Rc = [];
end
Ra = setdiff(A1,Rc);

Contact us at files@mathworks.com