function cy=equilib(cx,alphas)
%
%computes the vapour compositions cy based on the liquid compositions cx and 
%the relative volatilities alphas
%
nc=length(alphas);
if (size(cx,2)~=nc-1)
   y=[];
   disp('equilib: Mismatch between comp. vector and number of comp.');
   disp(alphas);
   disp(cx);
   return
end
if (size(cx,2)>1)
   cx=[cx,1-sum(cx,2)];
else
   cx=[cx,1-cx];
end
temp=cx*diag(alphas);
rowsum=sum(temp,2);
cy=diag(1./rowsum)*temp;
cy=cy(:,1:nc-1);

   
