A simultaneous linear equation with coefficients as variables
Ältere Kommentare anzeigen
How can I solve a simultaneous linear equation in which the coefficients are variables?
1 Kommentar
Torsten
am 11 Jan. 2023
Include an example for what you mean.
Akzeptierte Antwort
Weitere Antworten (1)
I assume you mean simultaneous linear equations where the coefficients are parameters that are assumed to be fixed, and not estimated, but may not be known at time of solution. For example:
syms a x y
EQ(1) = a*x + 2*y == 3;
EQ(2) = x - y == 2;
xy = solve(EQ,[x,y])
So simple enough. Or, we can convert the problem to a matrix form, like this:
[A,B] = equationsToMatrix(EQ,[x,y])
The solution now uses backslash.
xy = A\B
Which is the same solution as found by solve.
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
