Error using network/subsref (line 198) Index exceeds matrix dimensions. Error in Pelatihan (line 70) net.IW{1,3};

조회 수: 1 (최근 30일)
net = newff(input,target,[10 5],{'logsig','logsig'},'trainlm'); net.performFcn = 'mse'; net.trainParam.epochs = 1000; net.trainParam.goal = 1e-6; net.trainParam.mc = 0.95; net.trainParam.lr = 0.1; net.outputConnect, net.biasConnect; net.IW{1,1}; net.LW{3,1}; net = train(net,input,target); output = round(sim(net,input)); save net.mat net

답변 (1개)

Zuber Khan
Zuber Khan 2024년 9월 24일
Hi,
The error message that you are encountering suggests that you are trying to access an index in a cell array that doesn't exist. Specifically, in the following line of code,
net.IW{1,3};
you are trying to access the third column of the input weight matrix for the first layer, which likely doesn't exist given your network architecture.
The following command,
newff(input, target, [10 5], {'logsig', 'logsig'}, 'trainlm');
establishes a feed-forward backpropagation neural network consisting of two hidden layers where:
  • The first layer contains 10 neurons.
  • The second layer contains 5 neurons.
Note that that the following code line,
net.IW{1,1}
is used to get the weights for the input layer.
Therefore, you are getting an error when you are executing the code line "net.IW{1,3}" since ideally the column index must not exceed 1 here.
For more clarity, you can use the following command to see a graphical representation of your network.
view(net);
I hope this will address your concerns.
Regards,
Zuber

Community Treasure Hunt

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

Start Hunting!

Translated by