哪位高手帮我编写一下关于MATLAB BP神经网络拟合正弦曲线0到90度

2025-01-20 14:57:41
推荐回答(1个)
回答1:

p=0:0.05:pi*0.5;
t=sin(p);
net=newff(minmax(p),[10,1],{'tansig','purelin'},'trainlm');
y1=sim(net,p);
net.trainParam.epochs=1000;
net.trainParam.lr=0.05;
net.trainParam.goal=1e-5;
[net,tr]=train(net,p,t);
y2=sim(net,p);
plot(p,t,'-o',p,y2,'--');