FUNCTION REFERENCE

fittype

Create a curve or surface model for fit.

Create a curve or surface model for fit.

Syntax

ft = fittype(libraryModelName)

Syntax

ft = fittype(expression, 'independent', 'x', 'dependent', 'y', 'coefficients', {'a','b'}, 'problem', {'c'})

Syntax

ft = fittype({'term1', 'term2', ...})

Syntax

ft = fittype(@(a, b, x) a*exp(b*x))

In an equation the coefficients are the names that are not independent variables, problem parameters or functions, in order of first appearance; *, / and ^ act elementwise. A cell array of terms gives a linear model a*term1 + b*term2 + ... solved by linear least squares. For an anonymous function the last input is the independent variable unless 'independent' names others. Call ft(coefficients..., problems..., x) to evaluate. formula, coeffnames, argnames, numcoeffs, type, category and islinear describe the model.

Example

ft = fittype('a*exp(-b*x)+c'); coeffnames(ft)

Example

ft = fittype('poly2'); ft(1, 2, 3, [0 1 2])   % [3 6 11]

Differences from MATLAB: the 'options' argument is not supported yet; give fit options to fit.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.