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
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!