how do i solve a system of 5 equations

13 次查看(过去 30 天)
Hi everyone
i am having problems solving for the following
y1=((2.117)*a+2*b-1691.45);
y2=((2.8235)*a-4*b-1935.22);
y3=(c+608.11-366.21-(0.666)*b+(0.7058)*a);
y4=(d+211.43-(0.33)*b-(0.5294)*a);
y5=(e-608.11-153.91-(0.666)*b-(0.4705)*a);
i have tried using the solve command in the toolbox but it keeps returning a as an undefined variable. a is an unknown and i need to solve for it and b c d e .
Any help would be appreciated !
Thanks !
  1 个评论
bassam bitar
bassam bitar 2015-7-19
编辑:Walter Roberson 2015-7-19
so this is the code i have so far but the answers are way off
syms a b c d e
equ1= (2.117)*a+2*b-1691.45 == 0;
equ2= (2.8235)*a-4*b-1935.22 == 0;
equ3= c+608.11-366.21-(0.666)*b+(0.7058)*a == 0;
equ4= d+211.43-(0.33)*b-(0.5294)*a == 0;
equ5= e-608.11-153.91-(0.666)*b-(0.4705)*a ==0;
sol=solve([equ1,equ2,equ3,equ4,equ5],a,b,c,d,e);
aSol = sol.a
bSol = sol.b
cSol = sol.c
dSol = sol.d
eSol = sol.e

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2015-7-19
编辑:Star Strider 2015-7-19
You have to declare the symbolic variables first.
This works:
syms a b c d e
y1=((2.117)*a+2*b-1691.45);
y2=((2.8235)*a-4*b-1935.22);
y3=(c+608.11-366.21-(0.666)*b+(0.7058)*a);
y4=(d+211.43-(0.33)*b-(0.5294)*a);
y5=(e-608.11-153.91-(0.666)*b-(0.4705)*a);
[a,b,c,d,e] = solve(y1, y2, y3, y4, y5, [a,b,c,d,e]);
a = 753.54
b = 48.101
c = -741.71
d = 203.37
e = 1148.6
EDIT — Added solved variables
  4 个评论
madhan ravi
madhan ravi 2018-10-17
Accepted answer by Madhan Ravi since the OP didn't

请先登录,再进行评论。

更多回答(1 个)

Muhammad Usman Saleem

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by