www.pudn.com > zzznet.rar > CharSort.asv, change:2007-01-22,size:1137b


% SOMַ 
clear all; 
close all; 
clc; 
Nlong=4; 
Nwide=3; 
iteration=7000; 
 
sample=[ 
1	2	3	4	5	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3 
0	0	0	0	0	11	12	13	14	15	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3 
0	0	0	0	0	0	0	0	0	0	11	12	13	14	15	16	17	18	3	3	3	3	6	6	6	6	6	6	6	6	6	6 
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	11	12	13	14	1	2	3	4	2	2	2	2	2	2 
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	11	12	13	14	15	16 
]; 
Weight=Som(sample,Nlong,Nwide,iteration); 
 
figure 
hold on 
point=zeros(2,32); 
count=0.05*ones(1,32); 
for i=1:32 
    [maxDot,maxTab]=max(Weight'*sample(:,i));     
    centerL=mod(maxTab,Nlong); 
    centerW=ceil(maxTab/Nlong); 
    point(:,i)=[centerL;centerW]; 
    for(j=1:i-1) 
        if(~sum(abs(point(:,j)-point(:,i)))) 
            count(i)=count(i)+0.08; 
        end 
    end 
    if(i<27) 
         plot(centerL,centerW,'r*'); 
         text(centerL+count(i)-0.2,centerW+0.1,char(64+i),'FontSize',10); 
    else 
         plot(centerL,centerW,'bo'); 
         text(centerL+count(i)-0.2,centerW+0.1,char(22+i),'FontSize',10); 
    end 
end 
axis([-1,Nlong+1,0,Nwide+1]);