% Cross flow effectiveness relation 
function [Eff, NTU, Cr] = CrossFlowEff(C1,mixflag1,C2,mixflag2,Rnet)
  Cmin=min(C1,C2);
  Cmax=max(C1,C2);
  Cr=Cmin./Cmax;                  % 13-55
  NTU=1./Cmin./Rnet;              % 13-56
  [NTU,Cr,dim]=MatchSize(NTU,Cr); 
  Eff=zeros(dim);                 % initialize array
  if and(mixflag1(1)=='u',mixflag2(1)=='u')
    P=@(n,y)(n+1-[1:n])./factorial([1:n])*y.^(n+[1:n]')/factorial(n+1);
    S1=0;
    for n=1:100
      add=Cr.^n.*P(n,NTU);
      S1=S1+add;
      if add/S1 < 1e-9 break;
      end
    end
    Eff=1-exp(-NTU)-exp(-(1+Cr).*NTU).*S1;                 
  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)
      Eff(j)=(1-exp(-Cr(j).*(1-exp(-NTU(j)))))./Cr(j);     
    end 
    if mixflag1(1)=='m' j = find(C1==Cmin);
    else                j = find(C2==Cmin);
    end
    if ~isempty(j)
      Eff(j)=1-exp(-(1-exp(-Cr(j).*NTU(j)))./Cr(j));       
    end
  else
    error('error in hot and cold mixed/unmixed flags');
  end
end
