% solve set of linear equations
% for six-stage absorber
a = 0.7; % equilibrium factor
yin = 0.1; % vapor entry mole fraction
L = 20; % mol/s
G = 12; % mol/s
n = 6;  % number of stages
% compose A matrix
for i = 1:n
    A(i,i) = -(L+G*a);
end
for i = 1:n-1
    A(i,i+1) = G*a;
end
for i = 2:n
    A(i,i-1) = L;
end
% constant vector b
b = zeros(6,1);
b(6) = -G*yin;
% solve system of equations
x = A\b;
disp(x)



