| MATLAB Function Reference | Search  Help Desk |
| polyval | Examples See Also |
Syntax
y = polyval(p,x) [y,delta] = polyval(p,x,S)
Description
y = polyval(p,x)
returns the value of the polynomial p evaluated at x. Polynomial p is a vector whose elements are the coefficients of a polynomial in descending powers.
x can be a matrix or a vector. In either case, polyval evaluates p at each element of x.
[y,delta] = polyval(p,x,S)
uses the optional output structure S generated by polyfit to generate error estimates, y±delta. If the errors in the data input to polyfit are independent normal with constant variance, y±delta contains at least 50% of the predictions.
Remarks
Thepolyvalm(p,x) function, with x a matrix, evaluates the polynomial in a matrix sense. See polyvalm for more information.
Examples
The polynomial
p = [3 2 1]; polyval(p,[5 7 9])which results in
ans =
86 162 262
For another example, see polyfit.
See Also
polyfit, polyvalm