Home > wafo > wavemodels > ohhvpdf.m

ohhvpdf

PURPOSE ^

Joint (Vcf,Hd) PDF for lineare waves with Ochi-Hubble spectra.

SYNOPSIS ^

[f,fA,fB] = ohhvpdf(v,h,Hm0,def,norm)

DESCRIPTION ^

 OHHVPDF Joint (Vcf,Hd) PDF for lineare waves with Ochi-Hubble spectra. 
  
   CALL: f = ohhvpdf(v,h,Hm0,Tp) 
   
   f   = pdf evaluated at meshgrid(v,h). 
   v,h = vectors of evaluation points. 
   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 
  
  OHHVPDF approximates the joint distribution of (Vcf, Hd), i.e., crest 
  front velocity and wave height, for a Gaussian process with a bimodal 
  Ochi-Hubble spectral density. The empirical parameters of the model is 
  fitted by least squares to simulated (Vcf,Hd) data for 24 classes of Hm0. 
  Between 50000 and 150000 zero-downcrossing waves were simulated for 
  each class of Hm0. 
  OHHVPDF is restricted to the following range for Hm0:  
   0.5 < Hm0 [m] < 12 
  
  Example: 
  Hm0 = 6;Tp = 8;def= 2; 
  h = linspace(0,4*Hm0/sqrt(2))';  
  v = linspace(0,4*2*Hm0/Tp)'; 
  f = ohhvpdf(v,h,Hm0,def); 
  w    = linspace(0,40,5*1024+1).'; 
  S = ohspec2(w,[Hm0 def]); 
  dt = 0.3; 
  x = spec2sdat(S,80000,.2); rate = 8; 
  [vi,hi] = dat2steep(x,rate,1); 
  fk = kdebin([vi,hi],'epan',[],[],.5,128); 
  fk.title = f.title; fk.labx = f.labx;  
  plot(vi,hi,'.'), hold on 
  pdfplot(f),pdfplot(fk,'r'),hold off   
  
  See also  ohhpdf, thvpdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [f,fA,fB] = ohhvpdf(v,h,Hm0,def,norm) 
002 %OHHVPDF Joint (Vcf,Hd) PDF for lineare waves with Ochi-Hubble spectra. 
003 % 
004 %  CALL: f = ohhvpdf(v,h,Hm0,Tp) 
005 %  
006 %  f   = pdf evaluated at meshgrid(v,h). 
007 %  v,h = vectors of evaluation points. 
008 %  Hm0 = significant wave height [m]. 
009 %  def = defines the parametrization of the spectral density (default 1) 
010 %        1 : The most probable spectrum  (default) 
011 %        2,3,...11 : gives 95% Confidence spectra 
012 % 
013 % OHHVPDF approximates the joint distribution of (Vcf, Hd), i.e., crest 
014 % front velocity and wave height, for a Gaussian process with a bimodal 
015 % Ochi-Hubble spectral density. The empirical parameters of the model is 
016 % fitted by least squares to simulated (Vcf,Hd) data for 24 classes of Hm0. 
017 % Between 50000 and 150000 zero-downcrossing waves were simulated for 
018 % each class of Hm0. 
019 % OHHVPDF is restricted to the following range for Hm0:  
020 %  0.5 < Hm0 [m] < 12 
021 % 
022 % Example: 
023 % Hm0 = 6;Tp = 8;def= 2; 
024 % h = linspace(0,4*Hm0/sqrt(2))';  
025 % v = linspace(0,4*2*Hm0/Tp)'; 
026 % f = ohhvpdf(v,h,Hm0,def); 
027 % w    = linspace(0,40,5*1024+1).'; 
028 % S = ohspec2(w,[Hm0 def]); 
029 % dt = 0.3; 
030 % x = spec2sdat(S,80000,.2); rate = 8; 
031 % [vi,hi] = dat2steep(x,rate,1); 
032 % fk = kdebin([vi,hi],'epan',[],[],.5,128); 
033 % fk.title = f.title; fk.labx = f.labx;  
034 % plot(vi,hi,'.'), hold on 
035 % pdfplot(f),pdfplot(fk,'r'),hold off   
036 % 
037 % See also  ohhpdf, thvpdf 
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 % By pab 20.12.2000 
047  
048 error(nargchk(3,5,nargin)) 
049 if nargin<5|isempty(norm), norm=0;end  
050 if nargin<4|isempty(def), def=1;end  
051  
052 if Hm0>12| Hm0<=0  
053   disp('Warning: Hm0 is outside the valid range') 
054   disp('The validity of the Hd distribution is questionable') 
055 end 
056  
057 if def>11|def<1  
058   Warning('DEF is outside the valid range') 
059   def = mod(def-1,11)+1; 
060 end 
061  
062 global OHHVPAR 
063 if isempty(OHHVPAR) 
064   OHHVPAR = load('ohhvpar.mat'); 
065 end 
066 % Weibull distribution parameters as a function of Hm0 and h2 
067 A11  = OHHVPAR.A11s; 
068 B11  = OHHVPAR.B11s; 
069 Hm00 = OHHVPAR.Hm0; 
070 h2   = OHHVPAR.h2; 
071 [E2 H2] = meshgrid(Hm00,h2); 
072  
073  
074 Hrms = Hm0/sqrt(2); 
075 w    = linspace(0,100,16*1024+1).'; %original spacing 
076 %w    = linspace(0,1000/Tp,8*1024+1).'; % adaptiv spacing 
077 ch   = spec2char(ohspec2(w,[Hm0,def]),{'Tm02','eps2'}); 
078  
079 Tm02 = ch(1); 
080 eps2 = ch(2); 
081 Vrms = 2*Hm0/Tm02; 
082 if nargin<1 |isempty(v), v=linspace(0,4*Vrms); end 
083 if nargin<2 |isempty(h), h=linspace(0,4*Hrms); end 
084  
085 if norm==1, 
086   h = h*Hrms; 
087   v = v*Vrms; 
088 end 
089    
090 %fh = ohhpdf(h(:)/Hrms,Hm0,def,'time',1); 
091 % Fh = fh.f; 
092 [A0 B0 C0] = ohhgparfun(Hm0,def,'time'); 
093 Fh = wggampdf(h(:)/Hrms,A0,B0,C0); 
094  
095 method = '*cubic'; %'spline' 
096 A1 = exp(smooth(h2,interp2(E2,H2,log(squeeze(A11(:,def,:))).',Hm0(ones(size(h2))),h2,method),1,h/Hrms,1)); 
097 B1 = smooth(h2,interp2(E2,H2,squeeze(B11(:,def,:)).',Hm0(ones(size(h2))),h2,method),1,h/Hrms,1); 
098  
099 [V1 A1] = meshgrid(v/Vrms,A1); 
100 [V1 B1] = meshgrid(v/Vrms,B1); 
101  
102 f = createpdf(2); 
103 f.title = 'Joint distribution of (Hd,Vcf) in time'; 
104  
105 if norm==0 
106   f.f = repmat(Fh/Hrms,[1 length(v)]).*wweibpdf(V1,A1,B1)/Vrms; 
107   f.x = {v,h}; 
108   f.norm=0; 
109   f.labx={'Vcf [m/s]', 'Hd [m]'}; 
110 else 
111   f.f = repmat(Fh,[1 length(v)]).*wweibpdf(V1,A1,B1); 
112   f.x = {v/Vrms,h/Hrms}; 
113   f.labx={'Vcf', 'Hd'}; 
114   f.norm = 1; 
115 end 
116 f.note = ['Ochi-Hubble Hm0=' num2str(Hm0) ' def = ' num2str(def)]; 
117 f.f(isinf(f.f)|isnan(f.f))=0; 
118 [f.cl,f.pl] = qlevels(f.f);%,[10:20:90 95 99 99.9 99.99 99.999 99.9999]); 
119 if nargout>1, 
120   fA      = createpdf(2); 
121   fA.f    = A11; 
122   fA.x    = {Hm00,(1:11)' h2}; 
123   fA.labx = {'Hm0','def', 'h'}; 
124   fA.note = ['The conditonal Weibull distribution Parameter A(h)/Hrms' ... 
125     'for wave heigth as a function of h=Hd/Hrms, def and Hm0 for' ... 
126     'the ohspec2 spectrum']; 
127      
128   ra = range(A11(:)); 
129   st = round(min(A11(:))*100)/100; 
130   en = max(A11(:)); 
131   fA.cl   = st:ra/20:en; 
132 end 
133 if nargout>2, 
134   fB      = createpdf(2); 
135   fB.f    = B11; 
136   fB.x    = {Hm00,(1:11)',h2}; 
137   fB.labx = {'Hm0','def', 'h'}; 
138   fB.note = ['The conditonal Weibull distribution Parameter B(h)/Hrms' ... 
139     'for wave heigth as a function of h=Hd/Hrms, def and Hm0 for' ... 
140     'the ohspec2 spectrum']; 
141   ra = range(B11(:)); 
142   st = round(min(B11(:))*100)/100; 
143   en = max(B11(:)); 
144   fB.cl   = st:ra/20:en; 
145 end 
146 return 
147  
148  
149  
150  
151  
152  
153

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