multiple equations multiple variables solve command does not work
古いコメントを表示
Hello, I'm trying to solve a set of equations but i know the unknown variables don't have exact answers, instead i need to find something else:
the variables are b , d , e
the equations are;
eqn1 = ((d-e)/1.8)-(e/3.3)-((e-b)/0.68)== 0
eqn2 = ((e-b)/0.68) == ((b-9)/4.7)+((b+3)/1.5)
eqn3 = ((9-d)/1.5) == ((d)/4.7) + ((d-e)/1.8)
I want to find;
d-e = ?
b isnt required to be known, but i would be happy if you showed me a way to find the answer with learning b and without needing b at all,
The main problem for me here is not to solve this easily, but to understand. I can solve using other internet calcualtors somehow but i want to learn how i can get a wanted value the next time i have x equations and y variables.
Thank you
1 件のコメント
Cem Taylan Meriç
2021 年 11 月 2 日
採用された回答
その他の回答 (1 件)
These equations are linear in the unknowns, so can be solved as follows:
% M*X = V where X = [b; d; e]
% and the coefficients are in M,
% with the constants in V
M = [1/0.68, 1/1.8, -(1/1.8 + 1/3.3 + 1/0.68);
-(1/0.68 + 1/4.7 -1/1.5), 0, 1/0.68;
0, -(1/1.5 + 1/4.7 -1/1.8), -1/1.8];
V = [0; -(9/4.7+3/1.5); -9/1.5];
X = M\V;
b = X(1); d = X(2); e = X(3);
disp(X)
disp(d-e)
3 件のコメント
Cem Taylan Meriç
2021 年 11 月 2 日
John D'Errico
2021 年 11 月 2 日
編集済み: John D'Errico
2021 年 11 月 2 日
Alan, while what you have written is technically correct in how to solve the problem, it looks like you have some errors in the coefficients. And that means you got the wrong numerical solution. Just a minor error though. Since I used equationsToMatrix in my answer, it shows the differences clearly.
Alan Stevens
2021 年 11 月 2 日
Yes, I just eyeballed the numbers as I wrote the matrix and vector. I should have taken more care!
カテゴリ
ヘルプ センター および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


