www.pudn.com > AllNeuralNetworkCompute.rar > hopfield_mode.m, change:2005-07-01,size:816b


close all; 
clear all; 
O_0=[-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1]'; 
O_1=[-1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1]'; 
O_2=[-1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 1 1 1]'; 
O_8=[-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1]'; 
O=[O_0 O_1 O_2 O_8]; 
net=newhop(O); 
X=input('ַ(32*1):'); 
[Y]=sim(net,1,[],X); 
for k=1:100 
    if Y==O_0 
        disp('number is 0.'); 
        break; 
    elseif Y==O_1 
        disp('number is 1.'); 
        break; 
    elseif Y==O_2 
        disp('number is 2.'); 
        break; 
    elseif Y==O_8 
        disp('number is 8.'); 
        break; 
    else 
        [Y]=sim(net,1,[],Y); 
    end 
end