polyval

Evaluates a given polynomial using specified coefficients and datapoints.

Syntax

polyval(indep_vec, coeffs)

Argument

indep_vec
The independent vector.
coeffs
The coefficients of the polynomial.

Example

Templex Expression Results
{polyval({2},{1,3})} 7
{polyval({0,1,2},{-1,2,1})} -1, 2, 7
{polyval({0,1,2},{-2,0,1,3})} -2, 2, 26
Curve Math Vectors Results
x = 0:10:1

y = polyval(c1.x,{1,0,1})

Given c1, a curve is created which contains the values of 1 + x2 from 0 to 10.

Comments

The coefficients are ordered from the 0th to nth order. Therefore:

1 + 4x2

is written as:

{1,0,4}

The zero in the second vector of coefficients is necessary to indicate that no linear term appears in the equation. The first vector of independent values is used to calculate the dependent (output) vector.