function volts = adc2volts( counts, sn ) % ADC2VOLTS - Convert Hydra a/d counts to voltage % % volts = adc2volts( counts, sn ) % % Input: % counts - array of a/d counts % sn - Hydra serial number as indicated in .ctl file % % Output: % volts - array of voltages % % If the serial number is not recognized, will return volts = 5*counts/65536. % % Coefficients calculated in % /work2/sherwood/proj/GH2001/adv/calc_volts.m % Chris Sherwood, USGS % August 17, 2001 if(strcmpi('B45B',sn)|strcmpi('B45',sn)), a = 88.5529; b = 1.2820e+04; elseif(strcmpi('B51B',sn)|strcmpi('B51',sn)), a = 14.2569; b = 1.2819e+04; elseif(strcmpi('B52B',sn)|strcmpi('B52',sn)), a = -29.4892; b = 1.2830e+04; elseif(strcmpi('B59B',sn)|strcmpi('B59',sn)), a = -30.8056; b = 1.2827e+04; else fprintf(1,'Using default voltage conversion.\n') a = 0; b = 65536/5; end volts = (counts-a)./b;