Oxygen Saturation MATLAB Implementation

function [oxsat]=compute_oxsat(t,s)
% COMPUTE_OXSAT:  compute oxygen saturation from temperature and salinity
%
% Oxygen saturation value is the volume of oxygen gas absorbed from humidity-saturated
% air at a total pressure of one atmosphere, per unit volume of the liquid at the temperature
% of measurement (ml/l)
%
% USAGE: osat = compute_oxsat ( temperature, salinity );
%
% PARAMETERS:
%    Input:
%        temperature:  in degrees celsius
%        salinity: in PSU
%    Output:
%        osat: in ml/l
%
% Reference:  Application Note NO. 64, dated March 2001
%             SBE 43 Dissolved Oxygen Sensor
%             Appendix A - Computation of OXSAT
%

A1 = -173.4292;
A2 = 249.6339;
A3 = 143.3483;
A4 = -21.8492;
B1 = -0.033096;
B2 = 0.014259;
B3 = -0.00170;
t = t + 273.16;
oxsat = exp ( A1 + A2*(100./t) + A3*log(t/100) + A4*(t/100) ...
            + s.*(B1 + B2*(t/100) + B3*(t/100).*(t/100)));
return;
x = (t + 273.16)/100;
osat = exp( ((-21.8492*x-173.4292).*x + 249.6339) + s.*((-.0017*x+0.014259).*x-0.033096)+143.3484*log(x));

return;