matlab的narx的使用,神经网络工具箱NARX网络训练好之后,该怎么预测,具体如下...

原始数据中  x_t为降雨  y_t为R26-3水位,知道2015年降雨我要预测该年水位,网络训练代码如下:   请问要预测接下来怎么做?  怎么编写接下来的编码??

X = tonndata(x_t,false,false);

T = tonndata(y_t,false,false);

trainFcn = 'trainbr';  % Bayesian Regularization

inputDelays = 1:2;

feedbackDelays = 1:2;

hiddenLayerSize = 10;

net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);

[x,xi,ai,t] = preparets(net,X,{},T);

net.divideParam.trainRatio = 80/100;

net.divideParam.valRatio = 10/100;

net.divideParam.testRatio = 10/100;

[net,tr] = train(net,x,t,xi,ai);

y = net(x,xi,ai);

e = gsubtract(t,y);

performance = perform(net,t,y)

view(net)

netc = closeloop(net);

netc.name = [net.name ' - Closed Loop'];

view(netc)

[xc,xic,aic,tc] = preparets(netc,X,{},T);

yc = netc(xc,xic,aic);

closedLoopPerformance = perform(netc,tc,yc)

nets = removedelay(net);

nets.name = [net.name ' - Predict One Step Ahead'];

view(nets)

[xs,xis,ais,ts] = preparets(nets,X,{},T);

ys = nets(xs,xis,ais);

stepAheadPerformance = perform(nets,ts,ys)

5724a1379ceb16a514510c7aa4f77048.gif

2016-2-29 14:12 上传

点击文件名下载附件

17.29 KB, 下载次数: 552

原始数据

你可能感兴趣的:(matlab的narx的使用)