My code is about fitting two curves (one from calculated values and the other from laboratory data) by optimizing one parameter. The thing is that the result is always the same:
Initial point is a local minimum.
Optimization completed because the size of the gradient at the initial point
is less than the value of the optimality tolerance.
<stopping criteria details>
Optimization completed: The final point is the initial point.
The first-order optimality measure, 0.000000e+00, is less than
options.OptimalityTolerance = 1.000000e-05.
After that result, the parameter never changes and of course the optimization process never gets complete and the curves never fit, and I don't really know what to do. The summary of the code is on the next lines (I'm trying with Trust-Region-Reflective and levenberg-Marquardt, but the results are the same):
options=optimset('LargeScale','off', 'DiffMaxChange',0.01, 'DiffMinChange',0.0001, 'TolFun',1e-5, 'TolX',0.001);
HSfun basically takes the vectors (the mentioned curves) and calculates the difference in order to reduce that gradient:
calc_sh_strain=xlsread('C:\Users\Afuribeh\Desktop\UNAL-MED-DFV\U TXC TEST - Only u\CalculatedData.xls','C46:C235')*100;
calc_q=xlsread('C:\Users\Afuribeh\Desktop\UNAL-MED-DFV\U TXC TEST - Only u\CalculatedData.xls','D46:D235');
I would really appreciate if somebody can help me, maybe I'm not using the best optimization tool, or stopping criteria are not correct.
Thanks in advance.