% Model

Vf   = z1*Vl1 + (1-z1)*Vl2;                % m3/mol (molar volume feed)
Feed = q/Vf;                               % mol/s (feed rate)
x1   = n1/n;
p1s  = 10.^(A1 - B1/(T - 273.15 + C1))/750e-5;
p2s  = 10.^(A2 - B2/(T - 273.15 + C2))/750e-5;
p1   = x1*p1s;
p2   = (1-x1)*p2s;
p    = p1+p2;
y1   = p1/p;
Vm   = x1*Vl1 + (1-x1)*Vl2;

VG = (Vtot - n*Vm)/(1 - (p*Vm)/(R*T));
VL = Vtot - VG;
nL = VL/Vm;
nG = p*VG/(R*T);

hF = (z1*cpl1 + (1-z1)*cpl2)*(Tf - T0);
hL = (x1*cpl1 + (1-x1)*cpl2)*(T  - T0);
hG = (y1*cpv1 + (1-y1)*cpv2)*(T  - T0) + y1*hvap01 + (1-y1)*hvap02;

G = kg*(p - p0);

F(1) = Feed - G - L;
F(2) = Feed*z1 - G*y1 - L*x1;
F(3) = Feed*hF - G*hG - L*hL;

F = F';

