Polynomial coefficient vector to symbolic polynomial


r = poly2sym(c)
r = poly2sym(c,v)


r = poly2sym(c) returns a symbolic representation of the polynomial whose coefficients form the numeric vector c. The default symbolic variable is x. The variable v can be specified as a second input argument. If c = [c1 c2 ... cn], r = poly2sym(c) has the form


poly2sym uses sym's default (rational) conversion mode to convert the numeric coefficients to symbolic constants. This mode expresses the symbolic coefficient approximately as a ratio of integers, if sym can find a simple ratio that approximates the numeric value, otherwise as an integer multiplied by a power of 2.

r = poly2sym(c,v) is a polynomial in the symbolic variable v with coefficients from the vector c. If v has a numeric value and sym expresses the elements of c exactly, eval(poly2sym(c)) returns the same value as polyval(c, v).


The command

poly2sym([1 3 2])


ans =
x^2 + 3*x + 2

The command

poly2sym([.694228, .333, 6.2832])


ans =
(6253049924220329*x^2)/9007199254740992 +...
(333*x)/1000 + 3927/625

The command

poly2sym([1 0 1 -1 2], y)


ans =
y^4 + y^2 - y + 2

See Also

| |

Was this topic helpful?