How do I work with CFIT objects in curve fitting?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 8 Oct 2022
How do I work with CFIT objects in curve fitting?
Accepted Answer
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
1 Comment
Steven Lord
on 17 Feb 2021
For a list of other operations you can perform with cfit and sfit objects see this documentation page.
More Answers (0)
See Also
Categories
Find more on Fit Postprocessing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!