Why am I getting "Inf computed by model function, fitting cannot continue" error in "fit" function from the Curve Fitting Toolbox in MATLAB R2022b?

I am using MATLAB R2022b and the Curve Fitting Tool (“cftool”) to fit curves to a large dataset (16,000 points) that I load from a MAT file, process, and then fit. The first fit works fine, but after I reload variables to remove outliers and try to fit again, I get following error in the toolbox result - 
"Inf computed by model function, fitting cannot continue".
What is causing this error, and how can I fit my data successfully after removing outliers?

 采纳的回答

Regarding the "Inf computed by model function, fitting cannot continue" error message, this is likely expected depending on the data, fit type, and fit options. Changing some fit options like the bounds and start points can help with convergence, especially if the fit type or equation is complicated or prone to numerical instability.
For some of the built-in fit types and for custom equations, random start points may be used, so it is possible that the default values do not work well for the chosen fit type and data. It is recommended to use manually chosen points to improve the accuracy and speed of convergence.
The datasets may have been edited and outliers removed before reloading the variables in the app. If desired, you can exclude points within the app by clicking the "Exclusion Rules" button in the toolstrip or by selecting points interactively with the "Exclude outliers" axes toolbar button on the plots. By doing this, you do not need to reload the data in the app.
For more information about parametric fitting and start points, please refer to the Curve Fitting Toolbox documentation.

1 个评论

For example, suppose that your model function is
x/(B+1)
for unknown B, and suppose that all x are non-negative and all y are non-negative. In this scenario, there is no reason for B to be negative. However, initial hunt for B values will probably include B == -1 as a routine probe value. B assuming the value -1 together with the +1 in the expression, will lead to a division by 0, which combined with positive x will give inf.
The cure in this particular case would be to put bounds on B, such as [0, inf]
The initial search for trial coefficients commonly includes 1, 0, and -1.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品

版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by