data = [0 1 3 4; 0 1 4 1]; % original pattern with local minimum M = 100; % number of times pattern is replicated rand('state',1); % run deterministically (to exactly duplicate results) % replicate pattern M times x=100*rand(M,1)-50; y=100*rand(M,1)-50; dataorig=data; data=[]; for m=1:length(x), data=[data, [dataorig(1,:)+x(m); dataorig(2,:)+y(m)]]; end; plot(data(1,:),data(2,:),'ro'); xlabel('x'); ylabel('y'); % compute similarity matrix for i=1:length(data), for j=1:length(data), S(i,j)=sum(-(data(:,i)-data(:,j)).^2); end; end; pref=-10; [ap.idx,ap.netsim,ap.dpsim,ap.expref] = apcluster(S,pref,'plot','details'); k=length(unique(ap.idx(:,end))); [vsh.idx,vsh.netsim,vsh.dpsim,vsh.expref] = vshcluster(S,k,'details','preference',pref);