Why do I receive errors when training a multi-input Series/Parallel NARX network in Neural Network Toolbox 5.0.2 (R2007a)?

2 views (last 30 days)
I am trying to train a multivariable input using NEWNARXSP.
When I execute the following commands:
a={[0.1] [0.2] [0.3] [0.4] [0.5] [0.6] [0.7] [0.8] [0.9] [1.0]};
b={[-0.1] [0.2] [-0.3] [0.4] [-0.5] [0.6] [-0.7] [0.8] [-0.9] [1.0]};
c={[-0.2] [0.4] [-0.6] [0.8] [-0.2] [0.4] [-0.6] [0.8] [-0.2] [0.4]};
d1=[1 2];
d2=[1 2];
narx_net = newnarxsp({[0.1 1.0],[-0.9 1.0],[-0.6 0.8]},d1,d2,[5 1],{'tansig','purelin'});
p=[a;b;c] ;
t=c;
narx_net.trainFcn = 'trainbr';
narx_net.trainParam.show = 10;
narx_net.trainParam.epochs = 600;
narx_net = train(narx_net,p,t);
I receive the following error in TRAIN:
??? Error using ==> network.train
Inputs are incorrect size for network.
Cell array must have 2 rows.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Nov 2010
This change has been incorporated into the documentation in Release 2010b (R2010b). For previous releases, read below for any additional information:
The syntax for the inputs using TRAIN is different using multivariable inputs than for single-input networks.
To work around this issue, please rewrite your code as follows:
a=cell2mat(a);
b=cell2mat(b);
c=cell2mat(c);
d1=[1 2];
d2=[1 2];
narx_net = newnarxsp({[0.1 1.0;-0.9 1.0],[-0.6 0.8]},d1,d2,[5 1],{'tansig','purelin'});
p=[a;b;c];
P=mat2cell(p,[size(p,1)-1 1],ones(size(p,2),1));
T=mat2cell(c,1,ones(size(c,2),1));
narx_net.trainFcn = 'trainbr';
narx_net.trainParam.show = 10;
narx_net.trainParam.epochs = 600;
narx_net=train(narx_net,P,T);

More Answers (0)

Categories

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

Products


Release

R2007a

Community Treasure Hunt

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

Start Hunting!