Sunday, February 14, 2016

Matlab/ Solve System of Linear Equations with symbolic constances

Consider the following system:
a1x + b1y = c1
a2x + b2y = c2
Declare the system of equations:
syms x y a1 a2 b1 b2 c1 c2
eqn1 = a1*x + b1*y == c1
eqn2 = a2*x + b2*y == c2
[A,B]= equationsToMatrix([eqn1, eqn2], [x, y])
A =
[ a1, b1]
[ a2, b2]
B =
 c1
 c2

No comments :

Post a Comment