Solve for two equation with two unknown variables

14 Ansichten (letzte 30 Tage)
Daryun
Daryun am 8 Okt. 2018
clc
clear
a=436*10^-6;
rho=2.2*10^-5;
k=2.6;
Z=a^2/(rho*k);
Tcevre=-5+273;
ZTcevre=Z*Tcevre;
Ts=408.15;
Tsy=Ts/Tcevre;
h1=106.6575;
A1=0.04*0.04;
h2=53.3320;
A2=37*10^-4;
Nh=(h1*A1)/(0.9*h2*A2);
syms x y
for Nk=0.1:0.1:1
for Rr=1:0.1:2
Eq1= Nh*(Tsy-x)==(((ZTcevre*(x-y)*x)/(Rr+1))-((ZTcevre*(x-y)^2)/(2*(Rr+1)^2))+(x-y));
Eq2=(y-1)/Nk ==(((ZTcevre*(x-y)*y)/(Rr+1))-((ZTcevre*(x-y)^2)/(2*(Rr+1)^2))+(x-y));
[X,Y]=solve(Eq1,Eq2,x,y)
pretty(X)
% eqns = [Eq1,Eq2];
% S=solve(eqns, [x y]);
% S.x
% S.y
end
end
I have 4 unknowns and I'm converting two equations with two for loop to two. Then I used [X, Y] = solve (Eq1, Eq2, x, y) to solve these two, but when I wanted to find a numeric value, the terms root and Z ^ 3 came up. What command can I use or provide a code to be a numeric value? Could you help?

Akzeptierte Antwort

Star Strider
Star Strider am 8 Okt. 2018
Use vpasolve (link), specifically:
[X,Y]=vpasolve(Eq1,Eq2,x,y)
  7 Kommentare
Star Strider
Star Strider am 9 Okt. 2018
I thank you!
LAKKIMSETTI SUNANDA
LAKKIMSETTI SUNANDA am 3 Mär. 2021
Hi. I am also trying to solve two equations of 2 unkowns but unfortunately I am not getting the required solutions by using vpasolve. There may be infinite solutions but I needed the most converging solution. Here is the code. Can you please tell me how to find the roots. Thank you.
Y1=0.0125;l1=0.0105;be=0.0675;
lambda= [0.0426 0.0400 0.0405 0.0420];
syms Y2 l2;
t1e=((2*pi)/lambda(1))*l1;
t2e=((2*pi)/lambda(1))*l2;
eq1=2*Y1*tan(t1e)+Y2*tan(t2e)==0;
eq2= Y1*(t1e-((sin(t1e)*cos(t1e))/(sin(t2e)*cos(t2e))))==be;
E=[eq1,eq2];
S=vpasolve(E,Y2,l2);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by