How to calculate network value with 2 input vectors .

This is a very basic code to know how NARX Network works . d1=[1:2];
d2=[1:2];
net = narxnet(d1,d2);
net.inputs{1}.size=2;
net.inputs{2}.size=1;
net.numLayers=1;
net.biasConnect=0;
net.layers{1}.transferFcn='purelin';
net.layers{1}.dimensions=2;
net.IW{1,1}=[1 2 2 1; 3 1 1 4];
net.IW{1,2}=[1 3; 4 5];
x={[1 2] [3 4] [5 6] [7 8] };
y={10 12 16 18};
A=net(x,y)
This gives error
Error using network/sim (line 280)
Number of inputs does not match net.numInputs.
Error in network/subsref (line 17) otherwise, v = sim(vin,subs{:}); I have tried to understand Narx network in the same way as in the "neural network toolbox's user guide" explained about "Simulation with concurrent inputs in a dynamic network". Where is the error

1 Comment

Is there any reason why you won't use the help and doc example as a guide?

Sign in to comment.

Answers (1)

Is there any reason why you won't use the help and doc example as a guide?
For example, run the example. Then look at the net's properties to understand what was created.
Your x and y are not compatible
>> X = cell2mat(x), Y=cell2mat(y), whos X x Y y
X =
1 2 3 4 5 6 7 8
Y =
10 12 16 18
Name Size Bytes Class Attributes
X 1x8 64 double
Y 1x4 32 double
x 1x4 304 cell
y 1x4 272 cell
Did you mean
x={[1; 2] [3; 4] [5; 6] [7; 8] };
Hope this helps.
Thank you for formally accepting my answer
Greg

2 Comments

Sir, Example on NARX network is on real problem, This type of small example is not available so that I can check manually how it works.
x={[1; 2] [3; 4] [5; 6] [7; 8] }; I also tried with this, but it was not working.
What are you thinking? How is the response "But it was not working" supposed to help me help you? Did you get an error message or just the answer you don't want?
I repeat: Try a MATLAB data set. Once it runs, you can truncate the data and investigate a small problem.
help nndata

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 11 Nov 2013

Commented:

on 13 Nov 2013

Community Treasure Hunt

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

Start Hunting!