% Cross flow NTU relation 
function [NTU, Rnet, Cr] = CrossFlowNTU(C1,mixflag1,C2,mixflag2,Eff)
  Cmin=min(C1,C2);
  Cmax=max(C1,C2);
  Cr=Cmin./Cmax;                       % 13-55
  [Eff,Cr,dim]=MatchSize(Eff,Cr);      
  NTU=zeros(dim);                      % initialize array
  if and(mixflag1(1)=='u',mixflag2(1)=='u')
    NTU = -log(1-Eff.*(1+Cr))./(1+Cr); % 1st guess, then solve
    Rnet=1./Cmin./NTU;                 % use MFile 13-5 iteratively ...
    SysEqs=@(Rnet)Eff-CrossFlowEff(C1,mixflag1,C2,mixflag2,Rnet);
    Rnet=NSolve(SysEqs,Rnet);
    NTU =1./Cmin./Rnet;
  elseif xor(mixflag1(1)=='m',mixflag2(1)=='m')
    if mixflag1(1)=='m' j = find(C1==Cmax);
    else                j = find(C2==Cmax);
    end
    if ~isempty(j)
      NTU(j)=-log(1+log(1-Eff(j).*Cr(j))./Cr(j));             
    end 
    if mixflag1(1)=='m' j = find(C1==Cmin);
    else                j = find(C2==Cmin);
    end
    if ~isempty(j)
      NTU(j)=-log(1+Cr(j).*log(1-Eff(j)))./Cr(j);             
    end
    Rnet=1./Cmin./NTU;                                        
  else
    error('error in hot and cold mixed/unmixed flags');
  end
end
