Main Content

sfit

Constructor for sfit object

Description

example

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

An sfit object encapsulates the result of fitting a surface to data. They are normally constructed by calling the fit function, or interactively by exporting a fit from the Curve Fitter app to the workspace. You can get and set coefficient properties of the sfit object.

You can treat an sfit object as a function to make predictions or evaluate the surface at values of X and Y.

Like the cfit class, sfit inherits all fittype methods.

Note

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

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

Methods of sfit objects:

argnames Input argument names of cfit, sfit, or fittype object
categoryCategory of fit of cfit, sfit, or fittype object
coeffnamesCoefficient names of cfit, sfit, or fittype object
dependnamesDependent variable of cfit, sfit, or fittype object
formulaFormula of cfit, sfit, or fittype object
indepnamesIndependent variable of cfit, sfit, or fittype 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
quad2dNumerically integrate sfit object
setoptions Set model fit options
sfitConstructor for sfit object
typeName of cfit, sfit, or fittype object

Examples

collapse all

You can treat an sfit object as a function to make predictions or evaluate the surface at values of X and Y.

        x = 3 - 6 * rand( 49, 1 );
        y = 3 - 6 * rand( 49, 1 );
        z = peaks( x, y );
        sf = fit( [x, y], z, 'poly32' );
        zhat = sf( mean( x ), mean( y ) )

Input Arguments

collapse all

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

Example: fittype('linearinterp')

Coefficient values of the sfit object, specified as scalars.

Data Types: single | double

Output Arguments

collapse all

Function output, returned as an sfit object.

Version History

Introduced in R2009a