How to get the coefficients of an equation
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Geovane Gomes
le 8 Nov 2023
Réponse apportée : Sulaymon Eshkabilov
le 8 Nov 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 commentaires
Réponse acceptée
Dyuman Joshi
le 8 Nov 2023
How about -
syms x1 x2
eq = 2*x1 + x2 <= 0
out = flip(coeffs(lhs(eq)))
1 commentaire
Plus de réponses (1)
Sulaymon Eshkabilov
le 8 Nov 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 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!