I have trained the NARX net in MATLAB with below code.I want to test the trained network from new inputs (testX) and targets (testY).But i am getting error in last line forecastLoad = sim(net, testX')';
X = tonndata(trainX,false,false);
T = tonndata(trainY,false,false);
inputSeries = X;
targetSeries = T;
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 1:3;
feedbackDelays = 1:3;
hiddenLayerSize = 20;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation
% The function PREPARETS prepares time series data
[inputs,inputStates,layerStates,targets] = ...
preparets(net,inputSeries,{},targetSeries);
% Set up 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);
MAE = mae(errors);
%Test on new data
forecastLoad = sim(net, testX')';
error = testY-forecastLoad;
inputs
you used for training andtestX'
has different dimensions. Check it! – Mikhail_Sam