Analysis of Liquid and Vapor Phase Compositions and Flow Rates in a Multicomponent System: A MATLAB Simulation
This solved assignment uses MATLAB simulations to analyze liquid and vapor phase compositions in multicomponent systems.
Emma Thompson
Contributor
4.9
56
about 1 month ago
Preview (2 of 5)
Sign in to access the full document!
Analysis of Liquid and Vapor Phase Compositions and Flow Rates in a Multicomponent System: A MATLAB
Simulation
Matlab code
function project1(z,k,k_end,F,xLeft,xRight)
% This program plot the output compositions and flow rates in both phases as
% functions of K7 as K7 varying from 0.05 to 4.00 by taking n-component system
% with the feed compositions , K-values, total feed rate, bracket interval
% for roots and the range of k7( or nth k )
% Input::
% z values
% k values
% k_end in the form [a b] ; in this case its k7 [0.05 4]
% F -- feed rate
% xLeft : Initial Lower Guess
% xRight : Initial Upper Guess
% Output::
% Plot the output compositions and flow rates in both phases as
% functions of K7 as K7 varies from 0.05 to 4.00.
% Sample Test:
% F = 1500;
% z = [0.16,0.09,0.21,0.13,0.06,0.15,0.20];
% k = [3.52,1.92,1.22,0.84,0.43,0.08];
% k7 = 0.05:0.01:4;
% xLeft = 0;
% xRight = 1;
% k_end = [0.05 4];
% project1(z,k,k_end,F,xLeft,xRight)
% generating values of k7 in the given interval
k7 = k_end(1):0.01:k_end(2);
% check for no of inputs
if nargin<6,error('minimum 6 input arguments required'),end
% declare the output variables
root = zeros(1,length(k7));
V = zeros(1,length(k7));
L = zeros(1,length(k7));
x = zeros(length(k7),length(z));
y = zeros(length(k7),length(z));
for i=1:length(k7)
k1 = [k,k7(i)];
root(i) = BracketBisect(z,k1,xLeft,xRight);
V(i) = root(i)*F;
L(i)=F-V(i);
for j=1:length(z)
Simulation
Matlab code
function project1(z,k,k_end,F,xLeft,xRight)
% This program plot the output compositions and flow rates in both phases as
% functions of K7 as K7 varying from 0.05 to 4.00 by taking n-component system
% with the feed compositions , K-values, total feed rate, bracket interval
% for roots and the range of k7( or nth k )
% Input::
% z values
% k values
% k_end in the form [a b] ; in this case its k7 [0.05 4]
% F -- feed rate
% xLeft : Initial Lower Guess
% xRight : Initial Upper Guess
% Output::
% Plot the output compositions and flow rates in both phases as
% functions of K7 as K7 varies from 0.05 to 4.00.
% Sample Test:
% F = 1500;
% z = [0.16,0.09,0.21,0.13,0.06,0.15,0.20];
% k = [3.52,1.92,1.22,0.84,0.43,0.08];
% k7 = 0.05:0.01:4;
% xLeft = 0;
% xRight = 1;
% k_end = [0.05 4];
% project1(z,k,k_end,F,xLeft,xRight)
% generating values of k7 in the given interval
k7 = k_end(1):0.01:k_end(2);
% check for no of inputs
if nargin<6,error('minimum 6 input arguments required'),end
% declare the output variables
root = zeros(1,length(k7));
V = zeros(1,length(k7));
L = zeros(1,length(k7));
x = zeros(length(k7),length(z));
y = zeros(length(k7),length(z));
for i=1:length(k7)
k1 = [k,k7(i)];
root(i) = BracketBisect(z,k1,xLeft,xRight);
V(i) = root(i)*F;
L(i)=F-V(i);
for j=1:length(z)
Preview Mode
Sign in to access the full document!
100%
Study Now!
XY-Copilot AI
Unlimited Access
Secure Payment
Instant Access
24/7 Support
Document Chat
Document Details
Subject
Chemical Engineering