What dose the "Index exceeds matrix dimensions" mean when I train a dynamic neuron networks?

I did the example follow the Neural Network Use's guide 2012b on page 1-35,After entering the code which are follow:
net = linearlayer([0 1],0.02);
net.inputs{1}.size = 1;
net.layers{1}.dimensions = 1;
net.IW{1,1} = [0 0];
net.biasConnect = 0;
net.trainParam.epochs = 1;
Pi = {1};
P = {2 3 4};
T = {3 5 6};
net = train(net,P,T,Pi);
I got the result:
Index exceeds matrix dimensions.
Error in trainb>train_network (line 206)
[dw,IWLS{i,j}] = learnFcn.apply(net.IW{i,j}, ...
Error in trainb (line 55)
[out1,out2] = train_network(varargin{2:end});
Error in network/train (line 274)
[net,tr] = feval(net.trainFcn,'apply',net,tr,data,hints,net.trainParam);
Who can explain this situation for me ? Are the command codes on the user's guide book wrong? How can I fix the problem?

 Réponse acceptée

close all, clear all, clc
net = linearlayer([0 1],0.02);
net.inputs{1}.size = 1;
net.layers{1}.dimensions = 1;
net.IW{1,1} = [0 0];
net.biasConnect = 0;
% net.trainParam.epochs = 1;
Pi = {1};
P = {2 3 4};
T = {3 5 6};
for i=1:5
net.IW{1,1} = [ randn/100 randn/100 ];
net = train(net,P,T,Pi);
y = net(P)
end
y = [3.2583] [4.6624] [6.1790]
y = [3.2590] [4.6624] [6.1789]
y = [3.2598] [4.6625] [6.1788]
y = [3.2587] [4.6624] [6.1789]
y = [3.2575] [4.6623] [6.1791]
Thank you for formally accepting my answer
Greg

1 commentaire

I got the same result as it was after running your code Can you figure it out ?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by