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!


