1.构建BP网络对曲线y=0.12e^(-0.123x)+0.54e^(-0.17x)sin(1.23x)上的离散点进行数据拟合。
>> x=0:.1:10;
>> y=0.12*exp(-0.213*x)+0.54*exp(-0.17*x).*sin(1.23*x);%目标函数
>> net=newff(x,y,[5,1],{'tansig','tansig'});
>> net.trainParam.epochs=100;%最大步长设置为100
>> net=train(net,x,y);%训练网络
>> x0=0:.1:10;
>> figure(1);
>> y1=sim(net,x0);泛化
>> plot(x,y,'o',x0,y1,'r')
拟合效果: