sym2poly

Symbolic-to-numeric polynomial conversion

Syntax

c = sym2poly(s)

Description

c = sym2poly(s) returns a row vector containing the numeric coefficients of a symbolic polynomial. The coefficients are ordered in descending powers of the polynomial's independent variable. In other words, the vector's first entry contains the coefficient of the polynomial's highest term; the second entry, the coefficient of the second highest term; and so on.

Examples

The command

syms x u v
sym2poly(x^3 - 2*x - 5)

returns

ans =
 1     0    -2    -5

The command

sym2poly(u^4 - 3 + 5*u^2)

returns

ans =
 1     0     5     0    -3

and the command

sym2poly(sin(pi/6)*v + exp(1)*v^2)

returns

ans =
2.7183    0.5000         0

See Also

| | |

Was this topic helpful?