Matlab函数拟合之Neural Network方法记录

来源:互联网 发布:windows mfc图形编程 编辑:程序博客网 时间:2024/06/11 07:59

程序如下:

clear all; close all;x = [0 1 2 3 4 5 6 7 8];x1 = [0:0.1:8];t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99];% plot(x,t,'o')net = feedforwardnet(5);net = configure(net,x,t);net.trainParam.showWindow = false;% net.trainParam.showCommandLine = false; net.divideParam.trainRatio = 0.7;net.divideParam.valRatio = 0.15;net.divideParam.testRatio = 0.15;net = train(net,x,t);y1 = net(x1);y2 = net(x);plot(x,t,'o',x1,y1,'b',x,y2,'r')

其中,为了避免训练过程中弹出nntraintool的窗口,必须在configure之后、train之前加入trainParam.showWindow=false的设置。

0 0
原创粉丝点击