How to display my result in different script?
Show older comments
I need help about my code. It is running fine but I need to write as function of multiple outputs only. Here is programming:
%%Absorber Design program
V_1=181.4; % Inlet gas rate (Kmol/hr)
y_1 =0.25; % Solute mole fraction in inlet gas
y_2=0.02; %Required solute mole fraction in outlet gas
m=1.153; %Equilibrium constant (y_e/x=m)
muL=0.001;% Liquid viscosity (Pa-s)
x_2=0.005; % Solute concentration in inlet liquid
f=0.70; % Fraction flooding velocity
Fp=179; % Packing factor (ft^2/ft^3)
P=101.3; % Tower operating pressure (KPa)
T=303; % Tower operating temperature (K)
R=8.314; % Gas constant (Pa m^3/mol*K)
Mw=18; % Molar mass of water (Kg/Kmol)
Ma=29; % Molar mass of air (Kg/Kmol)
Dw=1000; % Density of water (Kg/m^3)
Y_1=y_1/(1-y_1); % Inlet gas composition in mole ratios
Y_2=y_2/(1-y_2); % Exit gas composition in mole ratios
V_s=(1-y_1)*V_1; % Flow of solute-free gas
X_2=x_2/(1-x_2); % Solute concentration in inlet liquid
X1_maxi=Y_1/(m*(1+Y_1)-Y_1); % Maximimum solute contration
Ls_mini=V_1*((Y_1-Y_2)/(X1_maxi-X_2));% Minimum absorbent flow rate
a=1.151; % Slope of operating line at minimun absorbent(Ls_mini/V_s)
Yop_mini=Y_1-a*(X1_maxi-X_2); % Operating line for minimum absorbant
Ls=a*Ls_mini; % Actual absorbent flow
b =Ls/V_s; % Slope for actual operating line
X_1= X_2+b*(Y_1-Y_2); % Exit liquid composition
Q_l=Ls*Mw/Dw; % Volumetric flow rate of liquid
A= Ls/(m*V_s); % Absorbation factor
N=(log(((Y_1-m*X_2)/(Y_2-m*X_2))*(1-1/A)+1/A))/ln(A); % Number of equilibrium stages
ra=X_1*Ls/(Y_1*V_s); % Fraction ammonia in gas that is recovered liquid
SR=ra/(1-ra);% Split ration of ammonian
L_prim=Mw*Ls; % Mass flow rate of liquid
V_prim=Ma*V_1; % Mass flow rate of gas
Dg=(Ma*P)/(R*T); % Density of gas from Ideal gas
X=(L_prim/V_prim)*(Dg/Dw); % Abscissa on GPDC
Yflood=exp(-(3.5021+1.028*log(X)+0.11093*(log(X))^2)); % Yflood
Cs=(Yflood/Fp*muL)^.5;
vg_f=Cs/(Dg/(Dw-Dg));
Qg=(V_1*R*T)/P; % Volumetric flow rate
Dt=(4*Qg/(f*vg_f*3.14))^.5; % Tower diameter
Dp= 0.98425; % 25 mm ceramic Raschig ring
HETP=1.5*Dp; % Random packing
Z=HETP*N; % Column height
Liq_dis=1.5*Dt; % Liquid disengagement space at the top
Vap_dis=2*Dt; % Vapor disengagement at the top
H=Z+Liq_dis+Vap_dis; % Total column height
vg_act=f*vg_f; % Actual Cs
Cs_act=f*Cs; % Actual Cs
Yact=Fp*(Cs_act)^2*(muL)^01; % Y-coordinate under actual condition
dp=800; % Pressure Drop(Pa/m)
dp_total=Z*0.3048*dp; % Pascal
I don't know how to display result like this: result=[Ls,N,Dt,Z,HETP,dp_total] in different script or by call it as function The code is for my mass transfer class.
Accepted Answer
More Answers (0)
Categories
Find more on Foundation and Custom Domains in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!