MATLAB Function Reference    

Polynomial evaluation



y = polyval(p,x) returns the value of a polynomial of degree n evaluated at x. The input argument p is a vector of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated.

x can be a matrix or a vector. In either case, polyval evaluates p at each element of x.

y = polyval(p,x,[],mu) uses in place of . In this equation, and . The centering and scaling parameters mu =  are optional output computed by polyfit.

[y,delta] = polyval(p,x,S) and [y,delta] = polyval(p,x,S,mu) use 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 = 5, 7, and 9 with

which results in

For another example, see polyfit.

See Also

polyfit, polyvalm

  polyint polyvalm