MATLAB: Passing New Data to Neural Net

neural networks

I am beginning to use the neural network toolbox to try to predict a value in a time series given three inputs. I can build the network using the toolbox, the question is how do I use it once it's built? The inputs look something like this: [1.01 .998 .995], with multiple rows like this where each row is a timestep. A similar question is posed here:
which is marked as answered where the answerer states "I think it's as simple as y = net(x)."
When I do this, however, I get an error of the form:
Error in network.sim>simData (line 366) err = '';
Output argument "data" (and maybe others) not assigned during call to "C:\Program Files\MATLAB\R2012b\toolbox\nnet\nnet\@network\sim.m>simData".
Error in network/sim (line 291) [data,err] = simData(net,X,Xi,Ai,T,EW);
Error in network/subsref (line 17) otherwise, v = sim(vin,subs{:});
Actually being able to use the network I create seems like a basic function. Why is it so hard to find the answer and examples?
here is the script generated by the Neural Network Toolbox:
% Solve an Autoregression Problem with External Input with a NARX Neural Network % Script generated by NTSTOOL % Created Thu Mar 21 08:56:21 EDT 2013 % % This script assumes these variables are defined: % % TestInputs – input time series. % TestOutputs – feedback time series.
inputSeries = tonndata(TestInputs,false,false); targetSeries = tonndata(TestOutputs,false,false);
% Create a Nonlinear Autoregressive Network with External Input inputDelays = 1:2; feedbackDelays = 1:2; hiddenLayerSize = 10; net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation % The function PREPARETS prepares timeseries data for a particular network, % shifting time by the minimum amount to fill input states and layer states. % Using PREPARETS allows you to keep your original time series data unchanged, while % easily customizing it for networks with differing numbers of delays, with % open loop or closed loop feedback modes. [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
% Setup Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% 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)
% View the Network view(net)
% Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotregression(targets,outputs) %figure, plotresponse(targets,outputs) %figure, ploterrcorr(errors) %figure, plotinerrcorr(inputs,errors)
% Closed Loop Network % Use this network to do multi-step prediction. % The function CLOSELOOP replaces the feedback input with a direct % 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 % For some applications it helps to get the prediction a timestep early. % The original network returns predicted y(t+1) at the same time it is given y(t+1). % For some applications such as decision making, it would help to have predicted % y(t+1) once y(t) is available, but before the actual y(t+1) occurs. % The network can be made to return its output a timestep early by removing one delay % so that its minimal tap delay is now 0 instead of 1. The new network returns the % same outputs as the original network, but outputs are shifted left one timestep. 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)

Best Answer

Upon rereading your post, I realized that this is NOT A TIMESERIES PROBLEM UNLESS your successive inputs are serially correlated. In other words, you have a three-dimensional input with a N-step time series in each component.
Please clarify.
If it is a time series problem, which of MATLAB's nndatasets do you want us to use to help you?
help nndatasets