title: matlab fmincon error "Solver stopped prematurely"
body: <p>I have a given path for 6 DOF manipulator for given knots. path(dof,knot)</p>
  
  <pre><code>path_f=[-0.5131   -0.6587   -1.0058   -1.4202   -1.7674   -1.9130
        -0.8696   -0.6711   -0.1980    0.3667    0.8399    1.0383
        -0.8961   -0.7433   -0.3789    0.0560    0.4205    0.5733
         1.1714    0.9639    0.4691   -0.1215   -0.6163   -0.8238
        -3.1000   -2.5800   -1.3400    0.1400    1.3800    1.9000
        -1.1514   -0.9439   -0.4491    0.1415    0.6363    0.8438]
  </code></pre>
  
  <p>I generated cubic splines between each joints and and each time interval is defined as h(i) and I tried to find the minimum h value which is <code>h(1)+h(2)+h(3)+h(4)+h(5)</code>.</p>
  
  <p>to solve that problem I wrote a code:</p>
  
  <pre><code>  options=optimset('Algorithm','sqp','Display','iter','DiffMinChange',1e-16,'DiffMaxChange',1e-4,'TolFun',1e-14,'TolX',1e-20,'MaxFunEvals',60000,'MaxIter',1000);
  
      h0=[0.001; 0.001; 0.001; 0.001; 0.001]
  
      h=fmincon(@(h)objecfun(h,path), h0, [], [], [], [], [0; 0; 0; 0; 0] , [], @(h) nonlconstraint(h,Robot,path_f,dof), options); 
  </code></pre>
  
  <p>When I run the code it says:</p>
  
  <p><em>Solver stopped prematurely.
  fmincon stopped because it exceeded the iteration limit,
  options.MaxIter = 1000 (the selected value).</em></p>
  
  <p>After 5th iteration f(x) value doesn't change and the results:</p>
  
  <pre><code>    Norm of First-order
   Iter F-count            f(x) Feasibility  Steplength        step  optimality
      0       6    2.500000e-01   2.001e+01                           1.000e+00
      1      12    3.903637e-01   8.013e+00   1.000e+00   6.374e-02   6.077e-01
      2      18    5.115308e-01   2.485e+00   1.000e+00   5.914e-02   3.255e-01
      3      24    5.519283e-01   4.258e-01   1.000e+00   2.941e-02   1.712e-01
      4      30    5.528961e-01   1.288e-02   1.000e+00   5.382e-03   3.098e-02
      5      36    5.530002e-01   4.399e-06   1.000e+00   2.153e-04   2.442e-02
      6      42    5.530000e-01   3.403e-12   1.000e+00   1.305e-07   1.828e-06
      7      48    5.530000e-01   8.704e-14   1.000e+00   1.050e-13   3.103e-07
      8      54    5.530000e-01   8.349e-14   1.000e+00   3.211e-15   1.465e-07
      9      65    5.530000e-01   6.573e-14   1.681e-01   2.713e-16   1.319e-07
     10      72    5.530000e-01   3.020e-14   7.000e-01   9.286e-16   3.740e-08
  </code></pre>
  
  <p>I have no idea about what the reason behind it. Could you please help me?</p>