## POLY Convert Roots To Polynomial Coefficients

Section: Optimization and Curve Fitting

### Usage

This function calculates the polynomial coefficients for given roots

        p = poly(r)

when `r` is a vector, is a vector whose elements are the coefficients of the polynomial whose roots are the elements of `r`. Alternately, you can provide a matrix

        p = poly(A)

when `A` is an `N x N` square matrix, is a row vector with `N+1` elements which are the coefficients of the characteristic polynomial, `det(lambda*eye(size(A))-A)`. Contributed by Paulo Xavier Candeias under GPL.

### Example

Here are some examples of the use of `poly`

    --> A = [1,2,3;4,5,6;7,8,0]

    A =
     1 2 3
     4 5 6
     7 8 0

    --> p = poly(A)

    p =
        1.0000   -6.0000  -72.0000  -27.0000

    --> r = roots(p)

    r =
       12.1229
       -5.7345
       -0.3884