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 个)
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!


