Skip to content

polyval

Evaluate a polynomial.

y = polyval(p, x)
[y, delta] = polyval(p, x, S, mu)

Returns the value of polynomial p evaluated at x. p is a row vector of coefficients in descending order of powerp = [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.

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²)
  • polyfit — Polynomial curve fit by least squares.