p = poly2sym(c)
creates the symbolic polynomial expression p from the vector of
coefficients c. The polynomial variable is
x. If c = [c1,c2,...,cn], then p =
poly2sym(c) returns .
This syntax does not create the symbolic variable x in the
MATLAB® Workspace.
Create a polynomial expression from a symbolic vector of coefficients. If you do not specify a polynomial variable, poly2sym uses x.
syms abcd
p = poly2sym([a,b,c,d])
p =
Create a polynomial expression from a symbolic vector of rational coefficients.
p = poly2sym(sym([1/2,-1/3,1/4]))
p =
Create a polynomial expression from a numeric vector of floating-point coefficients. The toolbox converts floating-point coefficients to rational numbers before creating a polynomial expression.
Create a polynomial expression from a numeric vector of integer coefficients.
p_coeffs = [1 4 5 4 4];
p = poly2sym(p_coeffs)
p =
Because poly2sym does not create the symbolic variable x in the workspace, create this variable by using syms. Find the roots of the polynomial by using solve.
syms x
p_roots = solve(p,x)
p_roots =
The polynomial has 4 roots. To check if these roots are indeed the correct solution, you can reconstruct the original polynomial from the roots.
Find the factored form of the polynomial by subtracting each root from x.
p_elem = x-p_roots
p_elem =
Take the product of the factored form of the polynomial.
p_new = prod(p_elem)
p_new =
Expand the polynomial and confirm that the result is the same as the original expression.
When you call poly2sym for a numeric vector
c, the toolbox converts the numeric vector to a vector
of symbolic numbers using the default (rational) conversion mode of sym.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.