function y = ycomp(Tk); 

% This function returns the vector of vapor compositions at given 
% values of temperature (Tk), pressure (P) and liquid composition (X).

global X P NC R W A alpha 

% Antoine equation where Psat [mmHg] and temperature Tk [K]
for i=1:NC
  log10Psat = A(i,1) - A(i,2) / (Tk-273.15 + A(i,3));
  Psat(i)   = 10^log10Psat;
end
        
% Phase equilibrium where P [atm] and Psat [mmHg]
gamma=NRTL(Tk);
q=Psat'.*X;
y=q.*gamma./(P*760);