Error running trained network in NARX

2 views (last 30 days)
Pavithra
Pavithra on 9 Mar 2023
Commented: Pavithra on 30 Mar 2023
I trained the network using 5x1656 matrix as input and 1x1656 as target using Bayesian Regularization in NARX. I am getting the following error when I try to deploy the trained network:
Error using network/sim (line 266)
Number of inputs does not match net.numInputs.
Error in network/subsref (line 15)
otherwise, v = sim(vin,subs{:});
Please help me sort this. (I am not of computer science background, hence cannot understand code. Please keep in mind while answering)

Answers (1)

Himanshu
Himanshu on 30 Mar 2023
Hello Pavithra,
As per my understanding, you are facing an error while deploying your trained NARX network in MATLAB. The error occurs because the number of input dimensions doesn't match the expected input dimensions of the network.
I assume you have successfully trained your NARX network using the Bayesian Regularization method. You can follow the below steps to troubleshoot the error:
  1. Check the dimensions of the input matrix you are using for simulation. Ensure that it has the exact dimensions used during training (5x1656).
  2. Ensure that your network is configured correctly before the simulation. The "view" function can visualize the network structure and verify the input and output dimensions.
  3. If the input matrix dimensions are correct, double-check how you call the "sim" function.
% syntax to view neural network
view(net);
% syntax to simulate neural network
output = sim(net, input);
% where 'net' is your trained NARX network, and 'input' is the input matrix with dimensions 5x1656
You can refer to the below documentation to understand more about the "view" and "sim" functions in MATLAB.
  1 Comment
Pavithra
Pavithra on 30 Mar 2023
Hello Himanshu,
Thank you very much for your valuable input. I checked the size of the network and used the same input variable which I used to train the network to simulate. But it still did not work.
But then, when I close the loop of the network and run it, it runs. But now the issue is that, it's giving the same value as output for all 1656 steps. Will it be possible to help me with this issue please?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!