please help me with the code for table 13.2 of example 13.6 in (attached file) as it is not providing me the correct + all values of the equation.

조회 수: 2 (최근 30일)
%%calculation for example of shortcut method distillation column
%%calculation for D
D = V/(1+R);
%%calculation for xD(c);xD(a);xD(b)
%%Taking C reference to r
xdc = xwc/(xwa*alphaAC^N + xwb*alphaBC^N + xwc*alphaCC^N);
xda = xwa*(xdc/xwc)*alphaAC^N;
xdb = xwb*(xdc/xwc)*alphaBC^N;
%% change in delta(t)= 0.5 hrs
for delta_t1 = [0 0.5 1 1.5 2]
W1 = W0-D*delta_t1;
%% with K=0
xwa1 = xwa+(xda-xwa)*((W1-W0)/W0);
xwb1 = xwb+(xdb-xwb)*((W1-W0)/W0);
xwc1 = xwc+(xdc-xwc)*((W1-W0)/W0);
%% Calculation of Nmin;Rmin
syms Rmin Nmin
solve(Rmin+(1.5835*(Nmin^1.7643))-10, Rmin-((2^Nmin-2)/(xwa1*(alphaAC)^Nmin+xwb1*(alphaBC)^Nmin+xwc1*(alphaCC)^Nmin)))
xdc1 = xwc1/(xwa1*alphaAC^Nmin + xwb1*alphaBC^Nmin + xwc1*alphaCC^Nmin);
xda1 = xwa1*(xdc1/xwc1)*alphaAC^Nmin;
xdb1 = xwb1*(xdc1/xwc1)*alphaBC^Nmin;
end

채택된 답변

Voss
Voss 2022년 11월 15일
편집: Voss 2022년 11월 15일
The main thing you're missing is that the equations (e.g., Eq 13-22 and 13-23) are expressing the result at time k+1 in terms of the result at time k. That is, the result at any given time is calculated in terms of the result at the previous time (not in terms of the initial result at time 0), so you must update your variables on each iteration of the loop in order to use them for the calculation in the next iteration.
Doing that gives pretty close agreement with the table in the paper:
V = 110;
R = 10;
xwa = 0.33;
xwb = 0.33;
xwc = 0.34;
alphaAC = 2;
alphaBC = 1.5;
alphaCC = 1;
N = 3;
W0 = 100;
%%calculation for example of shortcut method distillation column
%%calculation for D
D = V/(1+R);
%%calculation for xD(c);xD(a);xD(b)
%%Taking C reference to r
xdc = xwc/(xwa*alphaAC^N + xwb*alphaBC^N + xwc*alphaCC^N);
xda = xwa*(xdc/xwc)*alphaAC^N;
xdb = xwb*(xdc/xwc)*alphaBC^N;
%% change in delta(t)= 0.5 hrs
t = 0;
delta_t = 0.5;
n_t_steps = 4;
% initialize a results table with the results at time 0:
results = table( ...
0,W0,xwa,xwb,xwc,NaN,NaN,xda,xdb,xdc, ...
'VariableNames',{'Time, h','W, kmol','xWA','xWB','xWC','Nmin','Rmin','xDA','xDB','xDC'});
for t_step = 1:n_t_steps
t = t+delta_t;
W1 = W0-D*delta_t;
%% with K=0
xwa1 = xwa+(xda-xwa)*((W1-W0)/W0);
xwb1 = xwb+(xdb-xwb)*((W1-W0)/W0);
xwc1 = xwc+(xdc-xwc)*((W1-W0)/W0);
%% Calculation of Nmin;Rmin
syms Rmin Nmin
soln = solve( ...
Rmin+(1.5835*(Nmin^1.7643))-10, ...
Rmin-((2^Nmin-2)/(xwa1*(alphaAC)^Nmin+xwb1*(alphaBC)^Nmin+xwc1*(alphaCC)^Nmin)));
xdc1 = xwc1/(xwa1*alphaAC^soln.Nmin + xwb1*alphaBC^soln.Nmin + xwc1*alphaCC^soln.Nmin);
xda1 = xwa1*(xdc1/xwc1)*alphaAC^soln.Nmin;
xdb1 = xwb1*(xdc1/xwc1)*alphaBC^soln.Nmin;
% update these variables to be used next time around:
W0 = W1;
xwa = xwa1;
xwb = xwb1;
xwc = xwc1;
xda = xda1;
xdb = xdb1;
xdc = xdc1;
% append them to the results table:
results{end+1,:} = [t,W0,xwa,xwb,xwc,soln.Nmin,soln.Rmin,xda,xdb,xdc];
end
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
disp(results);
Time, h W, kmol xWA xWB xWC Nmin Rmin xDA xDB xDC _______ _______ _______ _______ _______ ______ ______ _______ _______ ________ 0 100 0.33 0.33 0.34 NaN NaN 0.64489 0.27206 0.083053 0.5 95 0.31426 0.3329 0.35285 2.6294 1.2829 0.59572 0.29618 0.1081 1 90 0.29944 0.33483 0.36573 2.6249 1.3094 0.58022 0.3049 0.11489 1.5 85 0.28384 0.33649 0.37966 2.6199 1.3386 0.56321 0.31423 0.12256 2 80 0.26741 0.3378 0.39479 2.6143 1.3711 0.54449 0.32423 0.13128

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Chemistry에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by