set Precision in lsqcurvefit

2 ビュー (過去 30 日間)
Marco Gaetani d'Aragona
Marco Gaetani d'Aragona 2020 年 1 月 16 日
コメント済み: Matt J 2020 年 1 月 16 日
Hi,
i want to set the precision of the output in terms of significant digits. In particular, i want to achieve a precision of 0.01. Setting the initial value of variables, and the options as follows:
a0 = [0.01;0.01;0.01];
options = optimoptions('lsqcurvefit','Algorithm','levenberg-marquardt' ,'MaxFunctionEvaluations',10000,'MaxIterations',5000);
lb = [];
ub = [];
[ahat,resnorm,residual,exitflag,output,lambda,jacobian] =lsqcurvefit(predicted,a0,x,y,lb,ub,options);
For instance, the output coefficients are ahat=[2.002 0.0251 0.1253]
I could round to specified significan digits after optimization of the regression. However, I would like to set the precision initially in order to achieve the best solution for the specified precision.
Can anyone help me with this issue?
Thanks in advance

回答 (2 件)

Matt J
Matt J 2020 年 1 月 16 日
編集済み: Matt J 2020 年 1 月 16 日
You cannot do such a thing with lsqcurvefit. What you describe would require that you rewrite your objective function and bounds in terms of different parameter units, thus scaling the parameters (in this case by a factor of 100) so that your precision requirement becomes equivalent to constraining the parameter values to integers. You would then use an optimization routine that supports integer constraints, like ga() or maybe surrogateopt(), to implement the least squares minimization.
These optimizers tend to be less reliable than non-integer constrained algorithms, so I tend to think you'd be making a rather doubtful tradeoff unless post-rounding is really, really unacceptable to you for some strong reason.
  1 件のコメント
Matt J
Matt J 2020 年 1 月 16 日
These optimizers tend to be less reliable than non-integer constrained algorithms, so I tend to think you'd be making a rather doubtful tradeoff
Although, you could try a 2-step refinement approach. First, do the fit using lsqcurvefit with post-rounding. Then, do precision-constrained optimization using ga as I outlined above, but include the result from lsqcurvefit in the initial population. That would improve the reliability greatly, I suspect.

サインインしてコメントする。


Spencer Chen
Spencer Chen 2020 年 1 月 16 日
Check out:
doc optimoptions
I think something like OptimalityTolerance is what you are looking for.
Blessings,
Spencer

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by