📄 p2.asv
字号:
clc;clear;
p=[0.7 0.8 1.0 0.3 0.0 -0.3 -0.5 -1.5;
1.8 0.6 0.8 0.5 0.2 0.8 -1.5 -1.3]; %p为输入向量
t=[1 0 0 1 1 1 0 0;
0 0 0 1 1 1 1 1]; %t为目标向量
plotpv(p,t);
net=newp([-1.5 1;-1.5 1],2); %建立一个双神经元感知器
plotpv(p,t);
linehandle=plotpc(net.iw{1}, net.b{1}); %绘制感知器分类线
e=1;
net=init(net); %初始化神经网络
linehandle=plotpc(net.iw{1}, net.b{1}); %绘制初始化感知器后的分类线
while(sse(e)) %修正感知器网络
[net,y,e]=adapt(net,p,t);
linehandle=plotpc(net.iw{1}, net.b{1},linehandle);
drawnow;
end
P=[0.7;0.9];
a=sim(net,P); %对输入向量P进行仿真
plotpv(P,a)
thepoint=findobj(gca,'type','line');
set(thepoint,'color','red');
hold on; %在原图上继续作图,不覆盖原图像
plotpv(p,t)
plotpc(net.iw{1}, net.b{1}); %绘制分类线
hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -