Main Content

cfit

Constructor for cfit object

Description

cfun = cfit(ffun, coeff1,...,coeffn) constructs the cfit object cfun using the model type specified by the fittype object ffun and the coefficient values coeff1, coeff2, etc.

Note

cfit is called by the fit function when fitting fittype objects to data. To create a cfit object that is the result of a regression, use fit.

You should only call cfit directly if you want to assign values to coefficients and problem parameters of a fittype object without performing a fit.

Methods of cfit objects:

argnames Input argument names of cfit, sfit, or fittype object
categoryCategory of fit of cfit, sfit, or fittype object
cfitConstructor for cfit object
coeffnamesCoefficient names of cfit, sfit, or fittype object
coeffvaluesCoefficient values of cfit or sfit object
confintConfidence intervals for fit coefficients of cfit or sfit object
dependnamesDependent variable of cfit, sfit, or fittype object
differentiateDifferentiate cfit or sfit object
formulaFormula of cfit, sfit, or fittype object
indepnamesIndependent variable of cfit, sfit, or fittype object
integrateIntegrate cfit object
islinearDetermine if cfit, sfit, or fittype object is linear
numargsNumber of input arguments of cfit, sfit, or fittype object
numcoeffsNumber of coefficients of cfit, sfit, or fittype object
probnamesProblem-dependent parameter names of cfit, sfit, or fittype object
probvaluesProblem-dependent parameter values of cfit or sfit object
setoptions Set model fit options
typeName of cfit, sfit, or fittype object

example

Examples

collapse all

Create a fittype object and call the cfit function.

f = fittype('a*x^2+b*exp(n*x)')
c = cfit(f,1,10.3,-1e2)
f =
     General model:
       f(a,b,n,x) = a*x^2+b*exp(n*x)
c =
     General model:
       c(x) = a*x^2+b*exp(n*x)
     Coefficients:
       a =           1
       b =        10.3
       n =        -100

Input Arguments

collapse all

Model type the cfit function uses to construct the cfit object, specified as a fittype constructed with the fittype function.

Example: fittype('poly2')

Coefficient values of the cfit object, specified as scalars.

Data Types: single | double

Output Arguments

collapse all

Function output, returned as a cfit object.

Version History

Introduced before R2006a