MATLAB Answers

0

How to repeat and store multiple calculations of vpasolve function in terms of adjusting a variable in the equation

SHIHAB HASNI さんによって質問されました 2019 年 11 月 4 日
最新アクティビティ Jyotsna Talluri さんによって 回答されました 2019 年 11 月 7 日
Asat = 16.3872;
Bsat = 3885.7;
Csat = 230.16;
w0 = 0.38;
En = 220;
n = 1.1;
MWwater = 18.01528;
% (*g/mol*)
R = 8.3145/MWwater;
T0 =4 + 273.15;
Tend = 62 + 273.15;
T = T0;
w = 0.05;
Psat = exp((Asat)- ((Bsat)/(T + Csat - 273.15)));
syms P
S = vpasolvevpasolve(w0*exp(-(((-R*T)*log(P/Psat))/(En))^n)== w, P,'Random',true)
%so if you run this code, S=0.030865627730443770149747137911306
% i want to know how to integrate this solution in a Loop where i can %increase initial tempreture (T0) and store the new solution until it reach %the maximum tempreture (Tend). where it will give me series of %Numerical solutions at each time i will change based on a loop.
%I dont know how to integrate the loop in this code,
%could you please help me here,
%Thanks.

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: Jyotsna Talluri 2019 年 11 月 7 日

Solve the equation for each value of T in a for loop by storing the solved value in a array each time
val=[];
for T= T0:5:Tend
Psat = exp((Asat)- ((Bsat)/(T + Csat - 273.15)));
syms P
S = vpasolve(w0*exp(-(((-R*T)*log(P/Psat))/(En))^n)== w, P,'Random',true);
val(end+1)=S;
end

  0 件のコメント

サインイン to comment.



Translated by