function p=convertparosfreqpress( Dc, F, T ); % CONVERTPAROSFREQPRESS - Converts ext paros freq to pressure % p=convertparosfreqpress( Dc, F, T ); % % Input: Dc - Structure w/ conversion coefficients % (see loaddruckcalfile.m) % F - Array of frequencies to convert (note that these % are 0.001*(1e6*PressFreqOffset*+LextPress), where % LextPress is the value recorded on the ADV. Valid % LextPress numbers are in the range of 35000 KHz, and % valid PressFreqOffset numbers are normally around 21, but % should sometimes be higher to prevent overflow as they % are stored by the logger. % T - Temperature (scalar value) [deg C] % % Output: p - Array of pressures [decibars] % % Based on Sontek advdata.c, Version 7.71 % with corrections for T calibration files. % Chris Sherwood, USGS % Last revised August 18, 2003 [m,n]=size(F); if(m==1 & n>1), F=F'; end nf = max(m,n); Psi_To_mbar=68.947573; % Infer temperature period from temperature % (invert quadratic equation used to calc temp from temp freq by % Paros) if( Dc.Y(3)~=0 ),error('This only works when Dc.Y(3) is zero'),end if(Dc.Y(2)~=0), u = ones(nf,1)*(-Dc.Y(1)-sqrt(Dc.Y(1)*Dc.Y(1)+4*T*Dc.Y(2))) ./ (2*Dc.Y(2)); else u = T; fprintf(1,'No Y coefficients.\n') end u2 = u .* u; %/* Pressure period in microsec */ tau = 1.0e6 ./ F; c = Dc.C(1) + Dc.C(2) * u + Dc.C(3) * u2; d = Dc.D(1) + Dc.D(2) * u; t0 = Dc.T(1) + Dc.T(2) * u + Dc.T(3) * u2 ... + Dc.T(4) * u .* u2 + Dc.T(5) * u2 .* u2; delta = (t0 ./ tau); delta = (1 - delta .* delta); p = 0.01*Psi_To_mbar*( c.*delta.*(1-d.*delta) );