A simultaneous linear equation with coefficients as variables

10 ビュー (過去 30 日間)
kyosya
kyosya 2023 年 1 月 11 日
回答済み: John D'Errico 2023 年 1 月 11 日
How can I solve a simultaneous linear equation in which the coefficients are variables?
  1 件のコメント
Torsten
Torsten 2023 年 1 月 11 日
Include an example for what you mean.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2023 年 1 月 11 日
編集済み: Matt J 2023 年 1 月 11 日
If the equations are,
A*X=B
then the roles of A and X are interchangeable and you can solve for A by doing,
A=B/X
Note, however that the usual requirement that you have at least as many equations as unknowns still applies if you hope to have a uniquely defined solution. This means that if A is MxN, then X must be NxP with P>=N and B must be MxP in order to solve for the M*N unknowns.

その他の回答 (1 件)

John D'Errico
John D'Errico 2023 年 1 月 11 日
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])
xy = struct with fields:
x: 7/(a + 2) y: -(2*a - 3)/(a + 2)
So simple enough. Or, we can convert the problem to a matrix form, like this:
[A,B] = equationsToMatrix(EQ,[x,y])
A = 
B = 
The solution now uses backslash.
xy = A\B
xy = 
Which is the same solution as found by solve.

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by