title: How to predict the result after training a network with NARX?
body: <p>I heard that Neural Network Toolbox is a excellent toolbox answering for training network and prediction. I tried to train a network as in the code sample below according the Autoregression Problem with External Input (NARX) standard, and it worked well especially in training. I got the <code>simplenarx_dataset</code> sample to make a sample data set with (1x100 cell) for both Inputs and Targets.</p>
  
  <p>Let's say 100 data sets for the period 1/1/2010 to 4/10/2010. My question is that I want to PREDICT results for the day after 4/10/2010 to 5/1/2010, for example. What should I do and how can I plot it? 
  Thank you very much for your help!</p>
  
  <p>Following is the code:</p>
  
  <pre><code>load simplenarx_dataset;
  % SimplenarxInputs (1x100 cell)
  % simplenarxTargets (1x100 cell)
  % 100 cell as a data starting 1/1/2010 and ending 4/10/2010
  % problem: predict data in the future, sample starting 5/10/2010 to 5/1/2010
  
  inputSeries = simplenarxInputs;
  targetSeries = simplenarxTargets;
  
  % Create a Nonlinear Autoregressive Network with External Input
  inputDelays = 1:2;
  feedbackDelays = 1:2;
  hiddenLayerSize = 10;
  net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
  
  % Customize output parameters at: net.outputs{i}.processParam
  net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
  net.inputs{2}.processFcns = {'removeconstantrows','mapminmax'};
  
  % open loop or closed loop feedback modes.
  [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
  
  % Setup Division of Data for Training, Validation, Testing
  net.divideFcn = 'dividerand';  % Divide data randomly
  net.divideMode = 'value';  % Divide up every value
  net.divideParam.trainRatio = 70/100;
  net.divideParam.valRatio = 15/100;
  net.divideParam.testRatio = 15/100;
  
  % Choose a Training Function
  net.trainFcn = 'trainlm';  % Levenberg-Marquardt
  net.performFcn = 'mse';  % Mean squared error
  
  % Customize plot parameters at: net.plotParam
  net.plotFcns = {'plotperform','plottrainstate','plotresponse', ...
   'ploterrcorr', 'plotinerrcorr'};
  
  % Train the Network
  [net,tr] = train(net,inputs,targets,inputStates,layerStates);
  
  % Test the Network
  outputs = net(inputs,inputStates,layerStates);
  errors = gsubtract(targets,outputs);
  performance = perform(net,targets,outputs)
  
  % Recalculate Training, Validation and Test Performance
  trainTargets = gmultiply(targets,tr.trainMask);
  valTargets = gmultiply(targets,tr.valMask);
  testTargets = gmultiply(targets,tr.testMask);
  trainPerformance = perform(net,trainTargets,outputs)
  valPerformance = perform(net,valTargets,outputs)
  testPerformance = perform(net,testTargets,outputs)
  
  % View the Network
  view(net)
  
  % connection from the outout layer.
  netc = closeloop(net);
  netc.name = [net.name ' - Closed Loop'];
  view(netc)
  [xc,xic,aic,tc] = preparets(netc,inputSeries,{},targetSeries);
  yc = netc(xc,xic,aic);
  closedLoopPerformance = perform(netc,tc,yc)
  
  % Early Prediction Network
  nets = removedelay(net);
  nets.name = [net.name ' - Predict One Step Ahead'];
  view(nets)
  [xs,xis,ais,ts] = preparets(nets,inputSeries,{},targetSeries);
  ys = nets(xs,xis,ais);
  earlyPredictPerformance = perform(nets,ts,ys)
  </code></pre>