How to get coefficients of equation defined by symbolic variable equation.?
6 views (last 30 days)
Show older comments
HEmant kuralkar
on 9 Jun 2017
Answered: Walter Roberson
on 9 Jun 2017
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 Comments
Accepted Answer
Walter Roberson
on 9 Jun 2017
[A,B] = equationsToMatrix(eqn,a)
A will be the coefficients and B will be what it equals
0 Comments
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!