function [new_oxy,Soc,Voffset,Boc,tcor,pcor,p1,p2]=...
    oxy_fit_poly2(volt,OXSAT,temp,press,sta,bot_oxy, ...
		Soc,Voffset,Boc,tcor,pcor,p1,p2);
%OXY_FIT_POLY2 - oxygen coeffs from volt and botOx (2-d poly fit)
% 

% $Revision: 1.5 $
% $Date: 2008/04/09 14:18:24 $
% $Id: oxy_fit_poly2.m,v 1.5 2008/04/09 14:18:24 duncombe Exp duncombe $

x=[volt OXSAT temp press sta];
beta(1,1)=Soc;
beta(1,2)=Voffset;
beta(1,3)=Boc;
beta(1,4)=tcor;
beta(1,5)=pcor;
beta(1,6)=p1;
beta(1,7)=p2;
beta0=non_lin_fit(x,bot_oxy,'oxygen_fit_poly2',beta);
Soc=beta0(1);
Voffset=beta0(2);
Boc=beta0(3);
tcor=beta0(4);
pcor=beta0(5);
p1=beta0(6);
p2=beta0(7);

new_oxy=((Soc.*(volt+Voffset))+Boc.*exp(-0.03.*temp)+ ...
	(p1.*sta+p2.*sta.^2)).*exp(tcor.*temp).*OXSAT.*exp(pcor.*press);

return;

