# What does the argument 'TolFun' indicate in function 'fit'?

17 ビュー (過去 30 日間)
Shuangfeng Jiang 2020 年 11 月 11 日

I would like to use the fucntion 'fit' to fit my data with the model, and there's the option called 'TolFun' which should be set when adopting the method of nonlinear Least Squares (Details in the help page: https://www.mathworks.com/help/curvefit/fit.html#d122e31414 ).
I know the name 'TolFun' may be a legacy, and it may correspond to 'OptimalityTolerance' or 'FunctionTolerance'. If it corresponds to the latter, is it a relative bound as mentioned in the help page https://www.mathworks.com/help/optim/ug/tolerances-and-stopping-criteria.html ?
If so, how to choose an appropriate value for it geneally when doing curve fitting?

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

### 採用された回答

Deepak Meena 2021 年 3 月 21 日
Hi,
TolFun is a lower bound on the change in the value of the objective function during a step. If |f(xi) – f(xi+1)| < TolFun, the iterations end. Solvers generally use TolFun as a relative bound, meaning iterations end when |f(xi) – f(xi+1)| < TolFun(1 + |f(xi)|), or a similar relative measure.
Coming to your question how to choose an appropriate value for it geneally when doing curve fitting , TolFun is not compulsory argument while using the fit function . Be default it takes value of 10^-6 . Try fitting the curve with the default value and See what are your results
Thanks

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

### カテゴリ

Help Center および File ExchangeLeast Squares についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by