how do i solve a system of 5 equations

43 views (last 30 days)
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 Comment
bassam bitar
bassam bitar on 19 Jul 2015
Edited: Walter Roberson on 19 Jul 2015
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

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 19 Jul 2015
Edited: Star Strider on 19 Jul 2015
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 Comments
madhan ravi
madhan ravi on 17 Oct 2018
Accepted answer by Madhan Ravi since the OP didn't

Sign in to comment.

More Answers (1)

Muhammad Usman Saleem
Muhammad Usman Saleem on 19 Jul 2015

Community Treasure Hunt

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

Start Hunting!