function frac=sept(i1,x1in2,xs1,in)
% sept: calculates the fractions to be used with frac
% function frac=sept(i1,x1in2,xs1,in)
% Argument  Gives
% i1       index of compound that is known in the exit streams
% x1in2    mol or (mass) fraction of i1 in the second exit stream
% xs1      composition of the first exit stream, mol or (mass) fractions       
% in       index of the inlet stream
% sept returns in frac, the fractions to be used in SEP   
% For addtional help and picture, see PICSEPT
% Example: >> ti=sept(1,.1,[0.8333 0 0.1668],5);
%          >> sep(ti,5,[4 3])
% OKB, TYLC

global ns
x1=xs1(i1);
n1=((x1in2*sum(ns(in,:)))-ns(in,i1))/(x1in2-x1);
frac=n1*(xs1./ns(in,:));
