
168 CHAPTER 7 Clustering
if(sum(m_tot==m_best)<.1*n_theta)
m_best=1;
theta_best=sum(theta_tot.*(m_tot==1))/sum(m_tot==1);
end
Step 2. Run the BSAS algorithm for =
best
:
order=randperm(N);
[bel, repre]=BSAS(X1,theta_best,q,order);
Plot the results (see Figure 7.3(b)), typing
figure(11), hold on
figure(11), plot(X1(1,bel==1),X1(2,bel==1),'r.',...
X1(1,bel==2),X1(2,bel==2),'g*',X1(1,bel==3),X1(2,bel==3),'bo',...
X1(1,bel==4),X1(2,bel==4),'cx',X1(1,bel==5),X1(2,bel==5),'md',...
X1(1,bel==6),X1(2,bel==6),'yp',X1(1,bel==7),X1(2,bel==7),'ks')
figure(11), plot(repre(1,:),repre(2,:),'k+')
Step 3. To run the reassignment procedure, type
[bel,new_repre]=reassign(X1, ...