How do I work with CFIT objects in curve fitting?

1 view (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Oct 2022
Edited: MathWorks Support Team on 8 Oct 2022
You can use the function CONFINT to find confidence intervals. Full documentation on this function is available at
Here is an example. Suppose that we have exported a fitted model from CFTOOL to the workspace.
fittedmodel1 =
General model:
fittedmodel1(x) = a*sin(x) + b
Coefficients (with 95% confidence bounds):
a = 1.018 (0.938, 1.097)
b = -0.03808 (-0.09455, 0.01839)
Now use CONFINT to get confidence intervals:
confint(fittedmodel1)
ans =
0.9380 -0.0946
1.0973 0.0184
Here, the first column is the 95% confidence interval on the first parameter and the second column is the 95% confidence interval on the second parameter. A second input to CONFINT can give other levels of confidence.
To get the actual parameter values, use structure indexing. For example, parameter a could be found by typing
fittedmodel1.a
Another function of interest is PREDINT, to find prediction intervals. Full documentation for this function is available at

More Answers (0)

Community Treasure Hunt

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

Start Hunting!