title: Couldn't fit the data using NEURAL NETWORKS IN MATLAB
body: <p>i have been trying the fit the data to a nonlinear model using neural networks in matlab. i have several sets of data. and my code is working fine for some data sets but not for all the data sets.</p>
  
  <p>for some data sets i am able to fit with good regression coefficient.for some sets of data it is giving me a constant value of output (i.e: almost '0' regression coefficient).</p>
  
  <p>this is the architecture of my neural network: Feedforward neural network with back propagation. no of hidden layers-1 no of neurons in a hidden layer -i am varying to see the result in each run</p>
  
  <p>CAN ANYONE POINT OUT WHAT IS GOING WRONG IN MY CODE PLEASE???</p>
  
  <pre><code>  clear;
    %% to load data from excel file
    filename='dD.xlsx';
    x=xlsread(filename);
    p=x(:,2:12);
    t=x(:,1);
    inputs = p';
    targets = t';
    % rng(200,'v4');
    rng(0)
    %% Create a Fitting Network
    hiddenLayerSize = 5;
    net = fitnet(hiddenLayerSize);
    %% Set up Division of Data for Training, Validation, Testing
    % net.divideFcn = 'dividetrain';  % No validation or test data
    net.divideParam.trainRatio = 100/100;
    net.divideParam.valRatio = 0/100;
    net.divideParam.testRatio = 0/100;
    net.trainFcn = 'trainbr';
    % net = configure(net,ptrans,tn);
    net.layers{1}.transferFcn = 'logsig';
    net.layers{2}.transferFcn = 'purelin';
    %% Train the Network
    [net,tr] = train(net,inputs,targets);
    tr.best_epoch;
    effective_param = tr.gamk;
    effective_no_of_parameters = effective_param(length(effective_param));
    wt_IL=net.IW{1,1};
    wt_HL= net.LW{2,1};
    bias_IL=net.b{1};
    bias_HL=net.b{2};
    %% Test the Network
    outputs = net(inputs);
    errors = gsubtract(outputs,targets);
    performance = perform(net,targets,outputs)
  </code></pre>