function dws = dwstats( f, d, S ) % DWSTATS - Calculate statistics from directional wave spectra % dws = dwstats( f, d, S ) % % Inputs: % f - Frequency bin centers (evenly spaced, Hz) % d - Directional bin centers (evenly spaced, Degrees) % S - Sea-surface spectra df = f(2)-f(1) dd = d(2)-d(1) dws.Hrms = 2*sqrt(2)*sqrt(sum(sum(real(S)*df*dd)));