www.pudn.com > AllNeuralNetworkCompute.rar > Adline_select.m, change:2005-07-11,size:758b


we=rands(1,16); 
x1=[1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1]'; 
x2=[1 1 1 1 1 -1 1 1 1 -1 1 1 -1 -1 -1 -1]'; 
x3=[1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]'; 
x4=[-1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 -1 -1]'; 
x5=[-1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1]'; 
x6=[-1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 -1 -1]'; 
xe=[x1 x2 x3 x4 x5 x6]; 
od=[60 0 -60 60 0 -60];%给定样本 
yout=zeros(1,16);e=zeros(1,16); 
PN=6;%样本数量 
d=input('学习速率d=___'); 
N=input('迭代步数k=___'); 
for k=1:N 
    Q=zeros(1,16); 
    for s=1:PN 
        mse=0; 
        yout(s)=we*xe(:,s); 
        e(s)=od(s)-yout(s); 
        Qadd=(xe(:,s))'*e(s); 
        Q=Q+Qadd;%这里采用增强型LMS学习算法 
        mse=mse+(e(s))^2; 
    end 
     we=we+2*d/PN*Q;   
     mse=mse/PN; 
end 
we 
mse