How to get coefficients of equation defined by symbolic variable equation.?
6 次查看(过去 30 天)
显示 更早的评论
I have number of symbolic variable defined by as follow:
% a1, a2, a3, a4, a5
a = sym('a',[1 5]);
Now I have an equation.. eqn = 3*a1 - 6*a3 + 9*a5 == 45;
I want to separate all the coefficients of above equation and store in 1*5 matrix.
I also want to store constant (=45) into another vector.
0 个评论
采纳的回答
Walter Roberson
2017-6-9
[A,B] = equationsToMatrix(eqn,a)
A will be the coefficients and B will be what it equals
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!