function zeta = vxtozeta(vx,F,h,z) % VXTOZETA - Converts velocities to surface elevations % This function converts current meter velocities to surface elevations % using linear theory, shallow water wave velocity, with all units in meters, % seconds and m/s. % % DECLARATIONS % vx = vector of velocity data to be converted. % F = sampling frequency in samples/sec. % h = is water depth % z = distance current meter is from the bottom. % % Doug Wilson, OHSU recl = length(vx); spctres = 2048; if(recl/spctres < 1) spctres = recl; end vxsp = spectrum(vx,spctres); [Y,III] = max(vxsp(:,1)); Peak_per = spctres./(III*F); %CRS thinks this is off by 1 freq bin % convert velocities into surface heights g = 9.81; sigma = 2*pi/Peak_per; % Wave angular velocity (mean sort of) kappa = sigma/sqrt(h*g); % Wave number = 2pi/L (linear shallow) zeta = sinh(kappa*h)*vx./(sigma*cosh(kappa*(h-z)));