feval - Evaluate cfit or fittype object

Syntax

y = feval(cfun,x)
y = feval(ffun,coeff1,coeff2,...,x)

Description

y = feval(cfun,x) evaluates the cfit object cfun at the predictor values in the column vector x and returns the response values in the column vector y.

y = feval(ffun,coeff1,coeff2,...,x) assigns the coefficients 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.

Remark

cfit or fittype objects can call feval indirectly using the following functional syntax:

y = cfun(x) % cfit objects;
y = ffun(coef1,coef2,...,x) % fittype objects;

Example

f = fittype('a*x^2+b*exp(n*x)');
c = cfit(f,1,10.3,-1e2);
X = rand(2)
X =
    0.0579    0.8132
    0.3529    0.0099

y1 = feval(f,1,10.3,-1e2,X)
y1 =
    0.0349    0.6612
    0.1245    3.8422
y1 = f(1,10.3,-1e2,X)
y1 =
    0.0349    0.6612
    0.1245    3.8422

y2 = feval(c,X)
y2 =
    0.0349
    0.1245
    0.6612
    3.8422
y2 = c(X)
y2 =
    0.0349
    0.1245
    0.6612
    3.8422

See Also

fit, fittype, cfit

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS