How to repeat and store multiple calculations of vpasolve function in terms of adjusting a variable in the equation
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (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
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!