function [Sg Sh Sl Xsl]=myfun(Nm,Ns,Nw,rho_l,rho_h,rho_g,Xml,Xwg,Xmg,Xsg,Xwh,Xmh,Xsh,Vp)

Sg =(Nm*rho_l - Nm*Xsh*rho_h + Ns*Xmh*rho_h - Ns*Xml*rho_l - Nm*Xwh*rho_h + Nw*Xmh*rho_h - Nw*Xml*rho_l -...
    Vp*Xmh*rho_h*rho_l + Vp*Xml*Xsh*rho_h*rho_l + Vp*Xml*Xwh*rho_h*rho_l)/(Vp*(Xmg*rho_g*rho_l - Xmh*rho_h*rho_l - ...
    Xmg*Xsh*rho_g*rho_h + Xmh*Xsg*rho_g*rho_h - Xml*Xsg*rho_g*rho_l + Xml*Xsh*rho_h*rho_l - Xmg*Xwh*rho_g*rho_h + ...
    Xmh*Xwg*rho_g*rho_h - Xml*Xwg*rho_g*rho_l + Xml*Xwh*rho_h*rho_l));
 
 
Sh=-(Nm*rho_l - Nm*Xsg*rho_g + Ns*Xmg*rho_g - Ns*Xml*rho_l - Nm*Xwg*rho_g + Nw*Xmg*rho_g - Nw*Xml*rho_l - Vp*Xmg*rho_g*rho_l...
    + Vp*Xml*Xsg*rho_g*rho_l + Vp*Xml*Xwg*rho_g*rho_l)/(Vp*(Xmg*rho_g*rho_l - Xmh*rho_h*rho_l - Xmg*Xsh*rho_g*rho_h +...
    Xmh*Xsg*rho_g*rho_h - Xml*Xsg*rho_g*rho_l + Xml*Xsh*rho_h*rho_l - Xmg*Xwh*rho_g*rho_h + Xmh*Xwg*rho_g*rho_h - ...
    Xml*Xwg*rho_g*rho_l + Xml*Xwh*rho_h*rho_l));
 
 
Sl =-(Nm*Xsg*rho_g - Ns*Xmg*rho_g - Nm*Xsh*rho_h + Ns*Xmh*rho_h + Nm*Xwg*rho_g - Nw*Xmg*rho_g - Nm*Xwh*rho_h + Nw*Xmh*rho_h +...
    Vp*Xmg*Xsh*rho_g*rho_h - Vp*Xmh*Xsg*rho_g*rho_h + Vp*Xmg*Xwh*rho_g*rho_h - Vp*Xmh*Xwg*rho_g*rho_h)/(Vp*(Xmg*rho_g*rho_l - ...
    Xmh*rho_h*rho_l - Xmg*Xsh*rho_g*rho_h + Xmh*Xsg*rho_g*rho_h - Xml*Xsg*rho_g*rho_l + Xml*Xsh*rho_h*rho_l - Xmg*Xwh*rho_g*rho_h ...
    + Xmh*Xwg*rho_g*rho_h - Xml*Xwg*rho_g*rho_l + Xml*Xwh*rho_h*rho_l));

Xsl=((Ns - Vp*(Sg*Xsg*rho_g + Sh*Xsh*rho_h))/(Sl*Vp*rho_l));
 
end 