perp2.m
来自「人工神经网络资料」· M 代码 · 共 27 行
M
27 行
P=rand(2,10)*10;
T=zeros(1,10);
for i=1:10
if (P(1,i)<= P(2,i)) T(i)=1
end
end
figure(1);
plotpv(P,T);
net=newp(minmax(P),1); %感知器生成函数
net.iw{1,1} = [-1 -1];%设定权值
net.b{1} = 1; %设定阈值
linehandle=plotpc(net.IW{1},net.b{1}); %分界线绘制函数
echo on
E=1;
n=0;
ep=1.0E-10;
while(sse(E)>ep)
[net,y,E]=adapt(net,P,T); %自适应函数
n=n+1;
perf(n)=sse(E) ; %平方误差性能函数
linehandle=plotpc(net.IW{1},net.b{1},linehandle);drawnow;
hold on
end
P1=rand(2,10)*10;
A=sim(net,P1);
figure(3);
plotpv(P1,A);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?