Coefficient values of cfit or sfit object
cfit
sfit
coeffvals= coeffvalues(fun)
example
coeffvals= coeffvalues(fun) returns the values of the coefficients, or parameters, of the cfit or sfit object fun as a 1-by-n vector coeffvals, where n = numcoeffs(fun).
coeffvals
fun
n
n = numcoeffs(fun)
collapse all
Load the data in the census.mat file and construct a fittype for a quadratic polynomial curve.
census.mat
fittype
load census f = fittype('poly2');
Obtain the coefficient names and the formula for the fittype object f.
f
coefficientNames = coeffnames(f)
coefficientNames = 3x1 cell {'p1'} {'p2'} {'p3'}
formula(f)
ans = 'p1*x^2 + p2*x + p3'
Fit the curve to the data and retrieve the coefficient values.
c = fit(cdate,pop,f); coefficientValues = coeffvalues(c)
coefficientValues = 1×3 104 × 0.0000 -0.0024 2.1130
Object of which you want to calculate the coefficients, specified as a cfit or sfit object.
Values of the coefficients of the cfit or sfit object fun, returned as a scalar or vector.
cfit | coeffnames | confint | predint | probvalues | sfit
coeffnames
confint
predint
probvalues
You have a modified version of this example. Do you want to open this example with your edits?