polyval
Evaluate a polynomial.
Syntax
Section titled “Syntax”y = polyval(p, x)[y, delta] = polyval(p, x, S, mu)Description
Section titled “Description”Returns the value of polynomial p evaluated at x. p is a row vector of coefficients in descending order of power — p = [a_n, a_{n-1}, ..., a_1, a_0] represents a_n*x^n + ... + a_1*x + a_0. x may be a scalar or array.
The S and mu arguments enable centered/scaled evaluation (matching what polyfit returns) and produce the delta confidence-interval output.
Examples
Section titled “Examples”polyval([1 -3 2], 5) % 12 (x² - 3x + 2 at x=5)polyval([1 0 0], [-2 -1 0 1 2]) % [4 1 0 1 4] (x²)See also
Section titled “See also”polyfit— Polynomial curve fit by least squares.