how can i solve this system on matlab?

조회 수: 1 (최근 30일)
Danny Farah
Danny Farah 2021년 10월 2일
댓글: David Hill 2021년 10월 2일
v+L =1
0.25=x1*L + y1*v
0.45 = x2*L +y2*v
0.30 = x3*L +y3*v
y1 = 2.7406*x1
y2 = 1.019*x2
y3 = 0.384*x3
x1+x2+x3=1

채택된 답변

Star Strider
Star Strider 2021년 10월 2일
A different approach —
syms L v x1 x2 x3 y1 y2 y3
sys = [(v+L ==1)
(0.25==x1*L + y1*v)
(0.45 == x2*L +y2*v)
(0.30 == x3*L +y3*v)
(y1 == 2.7406*x1)
(y2 == 1.019*x2)
(y3 == 0.384*x3)
(x1+x2+x3==1)];
S = solve(sys)
S = struct with fields:
L: [3×1 sym] v: [3×1 sym] x1: [3×1 sym] x2: [3×1 sym] x3: [3×1 sym] y1: [3×1 sym] y2: [3×1 sym] y3: [3×1 sym]
T = struct2table(S)
T = 3×8 table
L v x1 x2 x3 y1 y2 y3 __________________________________________________ __________________________________________________ __________________________________________________ __________________________________________________ __________________________________________________ __________________________________________________ __________________________________________________ __________________________________________________ 1 0 1/4 9/20 3/10 13703/20000 9171/20000 72/625 (125*3912412642537^(1/2))/16976652 + 36671861/242… - (125*3912412642537^(1/2))/16976652 - 34246625/2… 27596765/405712256 - (15*3912412642537^(1/2))/405… (3*3912412642537^(1/2))/21864320 + 15690759/21864… 6414861/29928820 - (3*3912412642537^(1/2))/299288… 75631694159/405712256000 - (41109*3912412642537^(… (3057*3912412642537^(1/2))/21864320000 + 15988883… 76978332/935275625 - (36*3912412642537^(1/2))/935… 36671861/2425236 - (125*3912412642537^(1/2))/1697… (125*3912412642537^(1/2))/16976652 - 34246625/242… (15*3912412642537^(1/2))/405712256 + 27596765/405… 15690759/21864320 - (3*3912412642537^(1/2))/21864… (3*3912412642537^(1/2))/29928820 + 6414861/299288… (41109*3912412642537^(1/2))/405712256000 + 756316… 15988883421/21864320000 - (3057*3912412642537^(1/… (36*3912412642537^(1/2))/935275625 + 76978332/935…
T = varfun(@double, T)
T = 3×8 table
double_L double_v double_x1 double_x2 double_x3 double_y1 double_y2 double_y3 ________ ________ __________ _________ _________ _________ _________ _________ 1 0 0.25 0.45 0.3 0.68515 0.45855 0.1152 29.685 -28.685 -0.0051094 0.98904 0.016069 -0.014003 1.0078 0.0061704 0.55696 0.44304 0.14115 0.44624 0.41261 0.38684 0.45472 0.15844
.

추가 답변 (1개)

David Hill
David Hill 2021년 10월 2일
syms v L x1 x2 x3 y1 y2 y3
eq1=v+L==1;
eq2=x1*L+y1*v==.25;
eq3=x2*L+y2*v==.45;
eq4=x3*L+y3*v==.30;
eq5=y1==2.7406*x1;
eq6=y2==1.019*x2;
eq7=y3==0.384*x3;
eq8=x1+x2+x3==1;
eqs=[eq1;eq2;eq3;eq4;eq5;eq6;eq7;eq8];
Sol=solve(eqs,[x1,x2,x3,y1,y2,y3,v,L]);
  댓글 수: 2
Danny Farah
Danny Farah 2021년 10월 2일
hello, thanks for your answer. i tried writing the code and running it, but when i run it, it does not provide an answer, but it does not give any erros as well, its just like moving to the next line
David Hill
David Hill 2021년 10월 2일
The solution is contained within Sol.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by