function oxy=SBE43_oxygen(Soc,Boc,Voffset,TCor,PCor,T,P,S,V)
%Soc,Boc,Voffset,TCor,PCor are calibration values
%Temp(temperature),P(pressure[dbars]),Sal(salinity)are from a CTD
%V is voltage from SBE43
%OxSat(OxS) calculation from Appendix A of SBE43 manual
%to change to mg/l multiply OxS by 1.42903
%Oxygen(ml/l) calculation from SBE43 calibration sheet

%Need absolute tempfor OxS
T=T+273.15; 

%Oxsat constants
A=[-173.4292 249.6339 143.3483 -21.8492];
B=[-0.033096 0.014259 -0.00170];

%Oxygen Saturation value-Volume of oxygen gas(STP)
OxS = A(1)+A(2).*(100./T)+A(3).*log(T./100)+A(4).*(T./100)+S.*(B(1)+B(2).*(T./100)+B(3).*((T./100).*(T./100)));%(T./100)^2
OxS = exp(OxS);%.*1.42903 for mg/l;
%back to Sea Temp in Celsius
T=T-273.15;
%(ml/l)or (mg/l)
oxy = (Soc.*(V+Voffset)+Boc.*exp(-0.03.*T)).*exp(TCor.*T+PCor.*P).*OxS;%*43.5;
