function split(t,in,out)
% split: mass-balance splitter module
% function split(t,in,out)
% Argument List
% Argument      Gives
%    t     the fraction of the inlet stream
%          that goes to each exit stream.      
%   in     the index of the inlet stream.
%   out    the indices of the exit streams.
% OKB
% Ex: split([.2 .3 .5],1,2:4)
%   would split stream 1 into streams 2, 3 and 4.
%   Stream 2 would get 20% of the flow, 
%   stream 3 would get 30% and stream 4 the rest.

global ns
lt=length(t);
if length(out)~=lt
   disp('Your t and out vectors are not the same length in split')
   return
end
if sum(t)~=1.0
   disp('The t vector does not sum to 1 in split')
   return
end
for i=1:lt
   ns(out(i),:)=t(i)*ns(in,:);
end
