How to get the coefficients of an equation
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Geovane Gomes
el 8 de Nov. de 2023
Respondida: Sulaymon Eshkabilov
el 8 de Nov. de 2023
Dear all,
Is it possible to extract the coefficients of an equantion defined as below:
syms x1 x2
eq = 2*x1 + x2 <= 0
By using coeffs and sym2poly did not work when it has the relational operator "<=".
c = coeffs(eq)
c = sym2poly(eq)
2 comentarios
Respuesta aceptada
Dyuman Joshi
el 8 de Nov. de 2023
How about -
syms x1 x2
eq = 2*x1 + x2 <= 0
out = flip(coeffs(lhs(eq)))
1 comentario
Más respuestas (1)
Sulaymon Eshkabilov
el 8 de Nov. de 2023
Maybe it is appropriate to work in a reverse order, e.g.:
syms x1 x2
Coeff = [2;1];
eq = [x1, x2]*Coeff<=0
0 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!