📄 bpxy.m
字号:
l=0.1;
cells=20;
times=3000;
w1=rand(cells,4);
w2=rand(3,cells);
yw1=rand(cells,1);
yw2=rand(3,1);
y=rand(3,159);
counts=1;
em=[0.001 0.001 0.001];
bj=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
e=[0 0 0]';
k=0;
for n=1:times
en=0;
for j=1:159
x=bpb(j,1:4);
net1=w1*x'-yw1;
out=logsig(net1);
net2=w2*out-yw2;
y(:,j)=net2;
det2=bpb(j,5:7)-y(:,j)';
det1=((det2*(w2))*out).*(bj-out);
w1=w1+det1*x*l;
w2=w2+(out*det2)'*l;
yw1=-det1*l+yw1;
yw2=-(det2)'*l+yw2;
en=en+power((det2)',2)./2;
e(:,j)=en;
end
k=0;
for i=1:3
if en(i)<em(i)
k=k+1;
end
if k==3
break;
end
counts=counts+1;
end
end
%测试误差
for j=1:159
x=bpb(j,1:4);
net1=w1*x'-yw1;
out=logsig(net1);
net2=w2*out-yw2;
y(:,j)=net2;
yr(:,j)=bpb(j,5:7)';
end
error=(y-yr)./yr;
yb=[1:159];
plot(yb,error);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -