MATLAB: Train and Simulate Neural Networks

train and simulate neural networks

Hi All, I am a newbie so please bear with me.
I have a input file containing (17×127) data (Force) and a target file of (3×127)(True Stress).
I have written the following code for training the neural networks:
p=Force; t=T_Stress;
net =newff(minmax(p),[10,1],{'tansig','purelin'},'trainlm');
net.trainParam.lr = .05; %Learning Rate net.trainParam.epochs = 300; %Max Ephocs net.trainParam.goal = 1e-5; %Training Goal in Mean Sqared Error net.trainParam.show = 50; %# of ephocs in display
[net,tr1] = train(net,p,t); o1 = sim(net,p)
However I get the following errors:
??? Error using ==> trainlm at 109 Output data size does not match net.outputs{2}.size.
Error in ==> network.train at 107 [net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);
Any helps with the above errors are very much appreciate it.

Best Answer

[I N ] = size(p)
[ O N ] = size(t)
H = 10
net =newff(minmax(p),[H,O]);
[net,tr1] = train(net,p,t);
o1 = sim(net,p)
Hope this helps
Greg