| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Curve Fitting Toolbox |
| Contents | Index |
| Learn more about Curve Fitting Toolbox |
y = feval(cfun,x)
z = feval(sfun,[x,y])
z = feval(sfun,x,y)
y = feval(ffun,coeff1,coeff2,...,x)
z = feval(ffun,coeff1,coeff2,...,x,y)
You can also treat fit objects as functions and call feval indirectly using the following syntax:
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;
This simpler syntax is recommended to evaluate these objects, instead of calling feval directly.
Use the feval method to evaluate the estimated function, either at your original data points, or at new locations. The latter is often 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.
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.
z = feval(sfun,[x,y]) evaluates the sfit object sfun at the predictor values in the two column matrix [x,y] and returns the response values in the column vector z.
z = feval(sfun,x,y) evaluates the sfit object sfun at the predictor values in the matrices x and y that must be the same size. It returns the response values in the matrix z that will be the same size as x and 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.
z = feval(ffun,coeff1,coeff2,...,x,y) achieves a similar result for a fittype object for a surface.
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![]() | excludedata | fit | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |