From: chris Austin on 20 Feb 2010 14:20 Hello, I managed (can't code well in matlab) to code a simple feedfoward Neural net and each time i ran the code i get the following error. "??? Index exceeds matrix dimensions. Error in ==> train>trainLayer at 35 momentum(i, size(input)) = eta * bias * deltas(i) + alpha * momentum(i, size(input) + 1); Error in ==> train at 23 [outputWeights, oMomentum] = trainLayer(hiddenOutput, outputWeights, oMomentum, outputDeltas); Error in ==> test at 14 train(img, hWeights, oWeights, target, hMom, oMom);" here (second to the las line of the code) is the portion of the code the error is pointing to.... What is possible wrong with it? function [weights, momentum] = trainLayer(input, weights, momentum, deltas) eta = 0.1; alpha = 0.9; bias = 1; for i = 1 : size(weights) for j = 1 : size(input) momentum(i, j) = eta * input(j) * deltas(i) + alpha * momentum(i, j); weights(i, j) = weights(i, j) + momentum(i, j); end momentum(i, size(input)) = eta * bias * deltas(i) + alpha * momentum(i, size(input) + 1); weights(i, size(input)) = weights(i, size(input)) + momentum(i, size(input) + 1); end
|
Pages: 1 Prev: Open Office Spreadsheet Next: data fitting for 2 data sets and functions |