Home > wafo > wavemodels > ohhscdf.m

# ohhscdf

## PURPOSE

Joint (Scf,Hd) CDF for linear waves with Ochi-Hubble spectra.

## SYNOPSIS

f = ohhscdf(Hd,Scf,Hm0,def,tail)

## DESCRIPTION

``` OHHSCDF Joint (Scf,Hd) CDF for linear waves with Ochi-Hubble spectra.

CALL: f = ohhscdf(Hd,Scf,Hm0,def)

f   = cdf
Hd  = zero down crossing wave height
Scf = crest front steepness
Hm0 = significant wave height [m].
def = defines the parametrization of the spectral density (default 1)
1 : The most probable spectrum  (default)
2,3,...11 : gives 95% Confidence spectra
tail = 1 if upper tail is calculated
0 if lower tail is calulated  (default)

OHHSCDF approximates the joint CDF of (Scf, Hd) in time,
i.e., crest front steepness (2*pi*Ac/(g*Td*Tcf)) and wave height,
for a Gaussian process with a bimodal Ochi-Hubble spectral density
(ohspec2). The empirical
parameters of the model is fitted by least squares to simulated
(Scf,Hd) data for 24 classes of Hm0. Between 50000 and 150000
zero-downcrossing waves were simulated for each class of Hm0.
OHHSCDF is restricted to the following range for Hm0:
0.5 < Hm0 [m] < 12
The size of f is the common size of the input arguments, Hd, Scf and
Hm0.

Example:
Hm0 = 6; def= 2;
Ec = 0.25;
Hc = 3;
lowerTail = 0;
upperTail = ~lowerTail
ohhscdf(Hc,Ec,Hm0,def)           % Prob(Hd<Hc,Scf<Ec)
ohhscdf(Hc,Ec,Hm0,def,upperTail) % Prob(Hd>Hc,Scf>Ec)

## CROSS-REFERENCE INFORMATION

This function calls:
 gaussq Numerically evaluates a integral using a Gauss quadrature. ohhspdf Joint (Scf,Hd) PDF for linear waves with Ochi-Hubble spectra. comnsize Check if all input arguments are either scalar or of common size. error Display message and abort function. interp1 1-D interpolation (table lookup) warning Display warning message; disable or enable warning messages.
This function is called by:

## SOURCE CODE

```001 function f = ohhscdf(Hd,Scf,Hm0,def,tail)
002 %OHHSCDF Joint (Scf,Hd) CDF for linear waves with Ochi-Hubble spectra.
003 %
004 %  CALL: f = ohhscdf(Hd,Scf,Hm0,def)
005 %
006 %  f   = cdf
007 %  Hd  = zero down crossing wave height
008 %  Scf = crest front steepness
009 %  Hm0 = significant wave height [m].
010 %  def = defines the parametrization of the spectral density (default 1)
011 %        1 : The most probable spectrum  (default)
012 %        2,3,...11 : gives 95% Confidence spectra
013 % tail = 1 if upper tail is calculated
014 %        0 if lower tail is calulated  (default)
015 %
016 % OHHSCDF approximates the joint CDF of (Scf, Hd) in time,
017 % i.e., crest front steepness (2*pi*Ac/(g*Td*Tcf)) and wave height,
018 %  for a Gaussian process with a bimodal Ochi-Hubble spectral density
019 % (ohspec2). The empirical
020 % parameters of the model is fitted by least squares to simulated
021 % (Scf,Hd) data for 24 classes of Hm0. Between 50000 and 150000
022 % zero-downcrossing waves were simulated for each class of Hm0.
023 % OHHSCDF is restricted to the following range for Hm0:
024 % 0.5 < Hm0 [m] < 12
025 % The size of f is the common size of the input arguments, Hd, Scf and
026 % Hm0.
027 %
028 % Example:
029 % Hm0 = 6; def= 2;
030 % Ec = 0.25;
031 % Hc = 3;
032 % lowerTail = 0;
033 % upperTail = ~lowerTail
034 % ohhscdf(Hc,Ec,Hm0,def)           % Prob(Hd<Hc,Scf<Ec)
035 % ohhscdf(Hc,Ec,Hm0,def,upperTail) % Prob(Hd>Hc,Scf>Ec)
036 %
038
039 % Reference
040 % P. A. Brodtkorb (2004),
041 % The Probability of Occurrence of Dangerous Wave Situations at Sea.
042 % Dr.Ing thesis, Norwegian University of Science and Technolgy, NTNU,
043 % Trondheim, Norway.
044
045
046 % History
047 % revised pab 09.09.2003
048 % By pab 06.02.2001
049
050 error(nargchk(3,5,nargin))
051 if (nargin < 5|isempty(tail)),  tail  = 0;end
052 if (nargin < 4|isempty(def)), def=1;end
053
054 multipleSeaStates = any(prod(size(Hm0))>1);
055 if multipleSeaStates
056   [errorcode, Scf,Hd,Hm0] = comnsize(Scf,Hd,Hm0);
057 else
058   [errorcode, Scf,Hd] = comnsize(Scf,Hd);
059 end
060 if errorcode > 0
061     error('Requires non-scalar arguments to match in size.');
062 end
063
064 if any(Hm0>12| Hm0<=0.5)
065   disp('Warning: Hm0 is outside the valid range')
066   disp('The validity of the Hd distribution is questionable')
067 end
068
069 if def>11|def<1
070   Warning('DEF is outside the valid range')
071   def = mod(def-1,11)+1;
072 end
073
074 global OHHSPAR
075 if isempty(OHHSPAR)
077 end
078 method = 'cubic';
079 Tm020 = OHHSPAR.Tm02;
080 Hm00  = OHHSPAR.Hm0;
081 Hrms = Hm0/sqrt(2);
082 Tm02 = interp1(Hm00,Tm020(:,def),Hm0,method);
083 Erms = 1.25*Hm0./(Tm02.^2); % Erms
084
085
086
087 s = Scf./Erms;
088 hMax = 10;
089 h = min(Hd./Hrms,hMax);
090
091 eps2 = 1e-6;
092
093 hlim    = h;
094
095 normalizedInput = 1;
096 lowerTail = 0;
097
098 if 0
099     % This is a trick to get the html documentation correct.
100     k = ohhspdf(1,1,2,3);
101   end
102
103 if (tail == lowerTail)
104   k       = find(h>2.5);
105   hlim(k) = 2.5;
106   f = gaussq('ohhspdf',0,hlim,eps2/2,[],s,Hm0,def,normalizedInput,5)...
107       + gaussq('ohhspdf',hlim,h,eps2/2,[],s,Hm0,def,normalizedInput,5);
108 else % upper tail
109   k       = find(h<2.5);
110   hlim(k) = 2.5;
111   f = gaussq('ohhspdf',h,hlim,eps2/2,[],s,Hm0,def,normalizedInput,7)...
112       + gaussq('ohhspdf',hlim,hMax,eps2/2,[],s,Hm0,def,normalizedInput,7);
113 end
114 return
115
116```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003