MATLAB Answers

Tonu
0

Neural Network error in train

Asked by Tonu
on 22 Jun 2013

Hi friends,

I get the following error while trying to use neural network toolbox in matlab. I am new to its use, thereby any help would be crucial.

Here are my codes

Basically I have a vector (1X75) as the input and to it I have two outputs, thereby I have created one loop to repeat the same value to for each input. *

I get the following error :

Error using trainlm (line 109)
Input data size does not match net.inputs{1}.size. *
% My codes 
load data 
I=data'; % 1 X 75 row vector
for i = 1 : length(data)
    z(1,i) = 0.0029;
    h(1,i) = 20;
end
O= [z;h]; % 2 X 75 vector
R=[0 1; 0 30 ]; % limits for the two ouput values
S=[5 2]; % No of inner  and output neurons  
   net = newff(R,S,{'tansig','purelin'}); 
   net=train(net,I,O);

Thanks

  0 Comments

Products

No products are associated with this question.

1 Answer

Answer by Greg Heath
on 25 Jun 2013
 Accepted answer

NEWFF interprets R as the limits of a two dimensional input; NOT an output.

use minmax(I) instead of R.

Thank you for formally accepting my answer

Greg

  1 Comment

Tonu
on 26 Jun 2013

Thank you Greg for pointing my mistake.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!