0
点赞
收藏
分享

微信扫一扫

用BP网络完成函数的逼近


用BP网络完成函数的逼近 ,此处主要为了演示效果,其中部分函数已经废弃。

具体如下:

 

% 用BP网络完成函数的逼近 
clf reset
figure(1)
P=-1:.1:1;
% T 为目标向量
T=0:0.314:6.28;
T=sin(T);
plot(P,T,'+');
title('训练向量');
xlabel('输入向量 P');
ylabel('目标向量 T');
S1=5;
[w1,b1,w2,b2]=initff(P,S1,'tansig',T,'purelin');
% >> help initff
% INITFF Inititialize feed-forward network up to 3 layers.
%
% This function is obselete.
% Use NNT2FF and INIT to update and initialize your network.
df=10; %学习过程显示频率
me=8000; %最大训练步数
eg=0.02 %误差指标
lr=0.01 %学习率
tp=[df me eg lr];
[w1,b1,w2,b2,ep,tr]=trainbp(w1,b1,'tansig',w2,b2,'purelin',P,T,tp);
% >> help trainbp
% TRAINBP Train feed-forward network with backpropagation.
%
% This function is obselete.
% Use NNT2FF and TRAIN to update and train your network.

举报

相关推荐

0 条评论