Matlab NARX with multiple inputs
Matlab NARX with multiple inputs
(OP)
thread575-155285: NARX Neural Network
I realize this is a bit late, but hopefully this may save someone else a headache in the future. It's currently 2010 and Matlab's documentation on this subject still isn't any better than it was in 2006. Instead of doing something like this:
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);
Do something like this:
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);
I realize this is a bit late, but hopefully this may save someone else a headache in the future. It's currently 2010 and Matlab's documentation on this subject still isn't any better than it was in 2006. Instead of doing something like this:
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);
Do something like this:
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);