Home > wafo > wavemodels > ohhsscdf.m

# ohhsscdf

## PURPOSE

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

## SYNOPSIS

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

## DESCRIPTION

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

CALL: f = ohhsscdf(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)

OHHSSCDF approximates the joint CDF of (Scf, Hd) in space,
i.e., crest front steepness (Ac/(Lcf)) 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 300000
zero-downcrossing waves were simulated for each class of Hm0.
OHHSSCDF 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
ohhsscdf(Hc,Ec,Hm0,def)           % Prob(Hd<Hc,Scf<Ec)
ohhsscdf(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. ohhsspdf Joint (Scf,Hd) PDF linear waves in space 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 = ohhsscdf(Hd,Scf,Hm0,def,tail)
002 %OHHSSCDF Joint (Scf,Hd) CDF for linear waves in space with Ochi-Hubble spectra.
003 %
004 %  CALL: f = ohhsscdf(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 % OHHSSCDF approximates the joint CDF of (Scf, Hd) in space,
017 % i.e., crest front steepness (Ac/(Lcf)) 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 300000
022 % zero-downcrossing waves were simulated for each class of Hm0.
023 % OHHSSCDF 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 % ohhsscdf(Hc,Ec,Hm0,def)           % Prob(Hd<Hc,Scf<Ec)
035 % ohhsscdf(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 % History
046 % revised pab 09.09.2003
047 % By pab 06.02.2001
048
049 error(nargchk(3,5,nargin))
050 if (nargin < 5|isempty(tail)),  tail  = 0;end
051 if (nargin < 4|isempty(def)), def=1;end
052
053 multipleSeaStates = any(prod(size(Hm0))>1);
054 if multipleSeaStates
055   [errorcode, Scf,Hd,Hm0] = comnsize(Scf,Hd,Hm0);
056 else
057   [errorcode, Scf,Hd] = comnsize(Scf,Hd);
058 end
059 if errorcode > 0
060     error('Requires non-scalar arguments to match in size.');
061 end
062
063 if any(Hm0>12| Hm0<=0.5)
064   disp('Warning: Hm0 is outside the valid range')
065   disp('The validity of the Hd distribution is questionable')
066 end
067
068 if def>11|def<1
069   Warning('DEF is outside the valid range')
070   def = mod(def-1,11)+1;
071 end
072
073 global OHHSSPAR
074 if isempty(OHHSSPAR)
076 end
077 method = 'cubic';
078 Tm020 = OHHSSPAR.Tm02;
079 Hm00  = OHHSSPAR.Hm0;
080 Hrms = Hm0/sqrt(2);
081 Tm02 = interp1(Hm00,Tm020(:,def),Hm0,method);
082 Erms = 2*Hm0./Tm02; % Erms
083
084
085
086 s = Scf./Erms;
087 hMax = 10;
088 h = min(Hd./Hrms,hMax);
089
090 eps2 = 1e-6;
091
092 hlim    = h;
093
094 normalizedInput = 1;
095 lowerTail = 0;
096
097 if 0
098     % This is a trick to get the html documentation correct.
099     k = ohhsspdf(1,1,2,3);
100   end
101
102 if (tail == lowerTail)
103   k       = find(h>2.5);
104   hlim(k) = 2.5;
105   f = gaussq('ohhsspdf',0,hlim,eps2/2,[],s,Hm0,def,normalizedInput,5)...
106       + gaussq('ohhsspdf',hlim,h,eps2/2,[],s,Hm0,def,normalizedInput,5);
107 else % upper tail
108   k       = find(h<2.5);
109   hlim(k) = 2.5;
110   f = gaussq('ohhsspdf',h,hlim,eps2/2,[],s,Hm0,def,normalizedInput,7)...
111       + gaussq('ohhsspdf',hlim,hMax,eps2/2,[],s,Hm0,def,normalizedInput,7);
112 end
113 return
114
115```

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