Contents Previous Next Subchapters

Evaluating A Descending Polynomial
Syntax polyval(px)
See Also polval , poly

Description
Returns the evaluation of the descending polynomial corresponding to p at each of the elements of x. The (i,j)-th element of the return value is
                   n-1                 1
     p[x   ] = p  x     + ... +  p    x     +  p
        i,j     1  i,j            n-1  i,j      n
where n is the length of the vector p. The integer, real, double-precision, or complex vector p specifies the polynomial to be evaluated. The integer, real, double-precision, or complex matrix x specifies the points at which to evaluate the polynomial. The return matrix has the same dimension as x and the same type as a binary operation between p and x. (See the coercion entry in the O-Matrix User's Guide.)

Example
     p = [-1, 0, 1]
     x = -2. : .1 : +2.
     v = polyval(p, x)
     gplot(x, v)

returns the following plot: