feval
Evaluate cfit
, sfit
, or fittype
object
Syntax
Description
Note
You can use feval
to evaluate fits, but you can treat fit objects as functions and call feval
indirectly using this syntax instead:
y = cfun(x) % cfit objects; z = sfun(x,y) % sfit objects z = sfun([x, y]) % sfit objects y = ffun(coef1,coef2,...,x) % curve fittype objects; z = ffun(coef1,coef2,...,x,y) % surface fittype objects;
Alternatively, you can use the feval
method to evaluate the estimated function, either at your original data points, or at new locations. The latter is referred to as interpolation or prediction, depending on the type of model. You can also use feval
to extrapolate the estimated function's value at new locations that are not within the range of the original data.
evaluates the y
= feval(cfun
,x
)cfit
object cfun
at the predictor values in the column vector x
and returns the response values in the column vector y
.
assigns the coefficients y
= feval(ffun
,coeff1,coeff2,...
,x
)coeff1
, coeff2
, etc. to the fittype
object ffun
, evaluates it at the predictor values in the column vector x
, and returns the response values in the column vector y
. ffun
cannot be a cfit
object in this syntax. To evaluate cfit
objects, use the first syntax.
achieves a similar result for a z
= feval(ffun
,coeff1,coeff2,...
,x
,y
)fittype
object for a surface.
Examples
Input Arguments
Output Arguments
Version History
Introduced before R2006a