how can i solve this system on matlab?

1 Ansicht (letzte 30 Tage)
Danny Farah
Danny Farah am 2 Okt. 2021
Kommentiert: David Hill am 2 Okt. 2021
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

Akzeptierte Antwort

Star Strider
Star Strider am 2 Okt. 2021
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
.

Weitere Antworten (1)

David Hill
David Hill am 2 Okt. 2021
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 Kommentare
Danny Farah
Danny Farah am 2 Okt. 2021
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 am 2 Okt. 2021
The solution is contained within Sol.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by