waves.zip (9 kB)To download separately the 3 routines, rightclick on the following links and select "Save target as..."
wavesp.m (version 1.11, 9 kB)
pr_corr.m (version 1.09, 8 kB)
zero_crossing.m (version 1.06, 6 kB)
wavesp 

wavesp(data,0.5,4)  simple use, with sensor 0.5 m above bed and sampling frequency 4 Hz 
wavesp(data,0.5,4,[0.05 0.45])  with pressure correction over the frequency range 0.050.45 Hz 
wavesp(data,0.5,4,'az')  returning all spectral parameters and the zerocrossing parameters 
wavesp(data,0.5,4,[],2) 
divide data in segments of 1/2 instead of 1/4 
[parameters,names]=wavesp(...)  returning parameters (row array) and their names 
[parameters,names,spectrum]=wavesp(...)  returning also the wave spectrum 
pr_corr 

surface=pr_corr(data,2.6,4,0.5)  simple use, with mean water depth 2.6 m, sampling frequency 4 Hz and sensor 0.5 above bed 
surface=pr_corr(data,[],4,0.5)  with undetrended data (seasurface above bottom) 
surface=pr_corr(data,2.6,4,0.5,[],[0.05 0.45]) 
with pressure correction over the frequency range 0.050.45 Hz 
correction=pr_corr([],2.6,4,0.5)  return the correction factor used to compensate the depth attenuation. 
Wave parameters computed by wavesp and zero_crossing
spectral waveparameters 

m_{0} 
Total variance Wave energy = waterdensity · g · m_{0} 

H_{m0}  significant wave height by spectral method  
T_{p}  Peak period  



T_{01}  average period m0/m1  
T_{02}  average period (m0/m2)^0.5  
T_{pc}  calculated peak period  
EPS2  spectral width parameter  
EPS4  spectral width parameter  
zerocrossing waveparameters 

H_{s}  Significant wave height  
H_{mean}  mean wave height  
H_{1/10}  height of highest 10%  
H_{max}  maximum wave height  
T_{mean}  mean wave period  
T_{significant}  mean period of highest 33% 