Statistics Toolbox    
polyval

Polynomial evaluation

Syntax

Description

Y = polyval(p,X) returns the predicted value of a polynomial given its coefficients, p, at the values in X.

[Y,DELTA] = polyval(p,X,S) uses the optional output 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.

If p is a vector whose elements are the coefficients of a polynomial in descending powers, then polyval(p,X) is the value of the polynomial evaluated at X. If X is a matrix or vector, the polynomial is evaluated at each of the elements.

The polyval function is part of the standard MATLAB language.

Examples

Simulate the function y = x, adding normal random errors with a standard deviation of 0.1. Then use polyfit to estimate the polynomial coefficients. Note that predicted Y values are within DELTA of the integer X in every case.

See Also
polyfit, polytool, polyconf


  polytool prctile