How to get the coefficients of an equation
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(1 个)
Sulaymon Eshkabilov
2023-11-8
Maybe it is appropriate to work in a reverse order, e.g.:
syms x1 x2
Coeff = [2;1];
eq = [x1, x2]*Coeff<=0
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!