| Symbolic Math Toolbox™ | ![]() |
r = poly2sym(c)
r = poly2sym(c, v)
r = poly2sym(c) returns a symbolic representation of the polynomial whose coefficients are in 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) s 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).
poly2sym([1 3 2]) returns
x^2 + 3*x + 2
poly2sym([.694228, .333, 6.2832]) returns
6253049924220329/9007199254740992*x^2+333/1000*x+3927/625
poly2sym([1 0 1 -1 2], y) returns
y^4+y^2-y+2
sym, sym2poly, polyval in the online MATLAB® Function Reference
![]() | poly | pretty | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |