function a=absorp(f,T,S)
% Sound absorption function
%
% Computes sound absorption coefficient at input frequencies
%
% User must enter:
%        vector of frequencies in Hz
%        mean water temperature in C
%        mean water salinity in ppt
%
% Outputs are absorption in dB/m

fsqkhz = (f ./ 1000) .^ 2;       % (freq in kHz)^2

%          Coefs from Urick,1967, pp.88, 89 and 92.
%                   alpha is in dB/m.

acoef = 1.86e-2;
bcoef = 2.68e-2;
tranf = 21.9 * (10 .^ (6-(1520 ./ (T + 273))));
lfterm = (acoef .* S .* tranf .* fsqkhz) ...
             ./ (tranf .^ 2 + fsqkhz);
hfterm = (bcoef .* fsqkhz) ./ tranf;
x=((0.1 * fsqkhz) ./ (1 + fsqkhz));
y=((40 * fsqkhz) ./ (4100 + fsqkhz));
vlowterm = x+y;
alpha1 = vlowterm + lfterm + hfterm;
a= (39.37007874 ./ (36 * 1000)) * alpha1;


