How to improve ANN results by reducing error through hidden layer size, through MSE, or by using while loop?up vote 0 down vote favorite

This is my source code and I want to reduce the possible errors. When running this code there is a lot of difference between trained output to target. I have tried different ways but didn't work so please help me reducing it.

% For help on training function 'trainlm' type: help trainlm% For a list of all training functions type: help nntrainnet.trainFcn = 'trainlm'; % Levenberg-Marquardt% Choose a Performance Function% For a list of all performance functions type: help nnperformancenet.performFcn = 'mse'; % Mean squared error