% Fin resistance for fins with constant cross-sectional area
function [Rfin, Vol, Bi] = FinApprox(h,k,A,P,L,tip)
  l=A./P;
  Bi=h.*l./k;
  if max(Bi) > 0.1
     warning = 'FinApprox: Bi > 0.1'
    Bi
  end
  SqrtBi=sqrt(Bi);
  L_l=L./l;
  if tip=='c'  % convective tip
    Rfin=(cosh(SqrtBi.*L_l)+SqrtBi.*sinh(SqrtBi.*L_l))./ ...
         (sinh(SqrtBi.*L_l)+SqrtBi.*cosh(SqrtBi.*L_l))./k./P./SqrtBi;
    Phi = (sinh(SqrtBi.*L_l)+SqrtBi.*cosh(SqrtBi.*L_l)-SqrtBi)./ ...
             (cosh(SqrtBi.*L_l)+SqrtBi.*sinh(SqrtBi.*L_l))./L_l./SqrtBi;
  else % tip=='a' adiabatic tip
    Rfin = cosh(SqrtBi.*L_l)./sinh(SqrtBi.*L_l)./k./P./SqrtBi;
    Phi = tanh(SqrtBi.*L_l)./L_l./SqrtBi;
  end
  Vol=A*L*[Phi,1-Phi];
end
