% Exact wide rectangular fin resistance
function [Rfin, Bi] = RecFinExact(h,k,L,t,W,tip)
  Bi=h.*t./k;
  if W/L < 10  warning = 'RecFinExact: W/L < 10'
  end
  EigenErr = @(b)b*sin(b/2)-Bi*cos(b/2);                               
  Bn=EigenVal(EigenErr,100,2*pi);                                      
  if tip=='c' % convective tip
    Sn = 8*(Bn.*sinh(Bn.*L./t)+Bi*cosh(Bn.*L./t)).*sin(Bn/2).^2 ...
       ./(Bn.*cosh(Bn.*L./t)+Bi*sinh(Bn.*L./t))./(Bn+sin(Bn));         
  else % t=='a' adiabatic tip
    Sn = 8*sinh(Bn.*L./t).*sin(Bn/2).^2./cosh(Bn.*L./t)./(Bn+sin(Bn)); % Problem 6-3
  end
  Sn(isinf(Sn))=0; Sn(isnan(Sn))=0; % replaces inf and nan with 0
  Rfin=1/sum(Sn)/k/W;                                                  
end                                       
