| MATLAB Function Reference | Search  Help Desk |
| polyval | Examples See Also |
y = polyval(p,x) [y,delta] = polyval(p,x,S)
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.
The polyvalm(p,x) function, with x a matrix, evaluates the polynomial in a matrix sense. See polyvalm for more information.
The polynomial
is evaluated at x = 5, 7, and 9 with
p = [3 2 1]; polyval(p,[5 7 9])which results in
ans =
86 162 262
For another example, see polyfit.
polyfit Polynomial curve fitting
polyvalm Matrix polynomial evaluation