how to use cfit to get fitobject and gof from a separately provided line
1 view (last 30 days)
Show older comments
Hi all,
I have a basic general question:
I am using [fitobject,gof]=fit(x,y,'poly1') to fit line segments.
I want to provide my own fit coefficients and get the same type of output about the goodness of fit.
How can I generate fitobject and gof using my independently provided fit coefficients, so that they will be in the same structure format as those generated by the 'fit' function?
thanks,
Rory
0 Comments
Answers (1)
Richard Willey
on 29 Apr 2011
The aren't any constructor options for the Fit Objects in Curve Fitting Toolbox.
The easiest way to accomplish your goal is to set upper and lower bounds for your coefficients that will constraint them to a precise value. For example, suppose that you wanted to force the regression coefficients to be "3" and "8"
X = 1:100
X = X'
Y = 5 + 10*X + randn(100,1)
[foo GoF] = fit(X,Y, 'poly1', 'Lower',[3 8], 'Upper',[3 8])
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!