Polynomial evaluation

evaluates the polynomial `y`

= polyval(`p`

,`x`

)`p`

at each point in `x`

.
The argument `p`

is a vector of length `n+1`

whose
elements are the coefficients (in descending powers) of an
`n`

th-degree polynomial:

$$p(x)={p}_{1}{x}^{n}+{p}_{2}{x}^{n-1}+\mathrm{...}+{p}_{n}x+{p}_{n+1}.$$

The polynomial coefficients in `p`

can be calculated for
different purposes by functions like `polyint`

, `polyder`

, and `polyfit`

, but you can specify any
vector for the coefficients.

To evaluate a polynomial in a matrix sense, use `polyvalm`

instead.

or
`y`

= polyval(`p`

,`x`

,[],`mu`

)`[`

use the optional output `y`

,`delta`

]
= polyval(`p`

,`x`

,`S`

,`mu`

)`mu`

produced by `polyfit`

to center and scale the
data. `mu(1)`

is `mean(x)`

, and
`mu(2)`

is `std(x)`

. Using these values,
`polyval`

centers `x`

at zero and scales it to
have unit standard deviation,

$$\widehat{x}=\frac{x-\overline{x}}{{\sigma}_{x}}\text{\hspace{0.17em}}.$$

This centering and scaling transformation improves the numerical properties of the polynomial.