Polynomials, Interpolation, and Integration
Polynomial functions are frequently used by numerical methods, and thus MATLAB provides several routines that operate on polynomials and piece-wise polynomials.
20.1 Representing polynomials Polynomials are represented as vectors of their coefficients, so f (x) = x3−15x2−24x+360 is simply
p = [1 -15 -24 360]
The roots of this polynomial (15, √24, and −√24):
r = roots(p)
Given a vector of roots r, poly(r) constructs the coefficients of the polynomial with those roots. With a little bit of roundoff error, you should see the coefficients of the original polynomial. Try it.