Home > wafo > wavemodels > jhwparfun.m

jhwparfun

PURPOSE ^

Wave height, Hd, distribution parameters for Jonswap spectrum.

SYNOPSIS ^

[A0,B0,C0]= jhwparfun(Hm0,Tp,gam,dim)

DESCRIPTION ^

 JHWPARFUN Wave height, Hd, distribution parameters for Jonswap spectrum. 
  
  CALL [a b c] = jhwparfun(Hm0,Tp,gamma,dim) 
  
  Hm0   = significant wave height [m]. 
  Tp    = peak period [s] 
  gamma = Peakedness parameter of the JONSWAP spectrum 
  dim   = 'time'  : Hd distribution parameters in time (default) 
  
   JHWPARFUN returns the truncated Weibull distribution parameters which 
   approximates the marginal PDF of Hd/Hrms, i.e., 
   zero-downcrossing wave height, for a Gaussian process with a  
   Jonswap spectral density.   
  
   The empirical parameters of the model is 
   fitted by least squares to simulated Hd data for 13 classes of 
   GAMMA between 1 and 7. 
   About 50000 zero-downcrossing waves were simulated for 
   each class of GAMMA for DIM=='time'. 
   JHWPARFUN is restricted to the following range for GAMMA and Tp:  
   1 <= GAMMA <= 7, and 3.6*sqrt(Hm0) < Tp < 5*sqrt(Hm0) 
   
   Example: 
   Hm0 = 6;Tp = 9;Hrms = Hm0/sqrt(2); 
   gam = getjonswappeakedness(Hm0,Tp); 
   [a b c] = jhwparfun(Hm0,Tp,gam); 
   h = linspace(0,4*Hrms)';  
   F = wtweibcdf(h/Hrms,a,b,c); 
   f = wtweibpdf(h/Hrms,a,b,c)/Hrms; 
   dt = 0.4; w = linspace(0,2*pi/dt,256)'; 
   S = jonswap(w,[Hm0 Tp,gam]); 
   xs = spec2sdat(S,80000,dt); rate=8; method=1; 
   [S,H] = dat2steep(xs,rate,method); 
   fk = kdebin(H,'epan',[],[],.5,128); 
   subplot(2,1,1) 
   empdistr(H,[h,F],1) 
   subplot(2,1,2) 
   plot(h,f), hold on, pdfplot(fk,'r'), hold off 
   
   See also  jhvpdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [A0,B0,C0]= jhwparfun(Hm0,Tp,gam,dim) 
002 %JHWPARFUN Wave height, Hd, distribution parameters for Jonswap spectrum. 
003 % 
004 % CALL [a b c] = jhwparfun(Hm0,Tp,gamma,dim) 
005 % 
006 % Hm0   = significant wave height [m]. 
007 % Tp    = peak period [s] 
008 % gamma = Peakedness parameter of the JONSWAP spectrum 
009 % dim   = 'time'  : Hd distribution parameters in time (default) 
010 % 
011 %  JHWPARFUN returns the truncated Weibull distribution parameters which 
012 %  approximates the marginal PDF of Hd/Hrms, i.e., 
013 %  zero-downcrossing wave height, for a Gaussian process with a  
014 %  Jonswap spectral density.   
015 % 
016 %  The empirical parameters of the model is 
017 %  fitted by least squares to simulated Hd data for 13 classes of 
018 %  GAMMA between 1 and 7. 
019 %  About 50000 zero-downcrossing waves were simulated for 
020 %  each class of GAMMA for DIM=='time'. 
021 %  JHWPARFUN is restricted to the following range for GAMMA and Tp:  
022 %  1 <= GAMMA <= 7, and 3.6*sqrt(Hm0) < Tp < 5*sqrt(Hm0) 
023 %  
024 %  Example: 
025 %  Hm0 = 6;Tp = 9;Hrms = Hm0/sqrt(2); 
026 %  gam = getjonswappeakedness(Hm0,Tp); 
027 %  [a b c] = jhwparfun(Hm0,Tp,gam); 
028 %  h = linspace(0,4*Hrms)';  
029 %  F = wtweibcdf(h/Hrms,a,b,c); 
030 %  f = wtweibpdf(h/Hrms,a,b,c)/Hrms; 
031 %  dt = 0.4; w = linspace(0,2*pi/dt,256)'; 
032 %  S = jonswap(w,[Hm0 Tp,gam]); 
033 %  xs = spec2sdat(S,80000,dt); rate=8; method=1; 
034 %  [S,H] = dat2steep(xs,rate,method); 
035 %  fk = kdebin(H,'epan',[],[],.5,128); 
036 %  subplot(2,1,1) 
037 %  empdistr(H,[h,F],1) 
038 %  subplot(2,1,2) 
039 %  plot(h,f), hold on, pdfplot(fk,'r'), hold off 
040 %  
041 %  See also  jhvpdf  
042  
043 % Reference   
044 % P. A. Brodtkorb (2004),   
045 % The Probability of Occurrence of Dangerous Wave Situations at Sea. 
046 % Dr.Ing thesis, Norwegian University of Science and Technolgy, NTNU, 
047 % Trondheim, Norway. 
048    
049 % History: 
050 % revised pab 10 jan 2004   
051 % by pab 29.11.2002 
052  
053 error(nargchk(2,4,nargin)) 
054 if nargin<3|isempty(gam), 
055   gam = getjonswappeakedness(Hm0,Tp) 
056 end 
057 if nargin<4|isempty(dim), dim = 'time';end 
058  
059 displayWarning = 0; 
060 if displayWarning 
061   if any(any(Tp>5*sqrt(Hm0) | Tp<3.6*sqrt(Hm0))) 
062     disp('Warning: Hm0,Tp is outside the JONSWAP range') 
063     disp('The validity of the parameters returned are questionable') 
064   end 
065   if any(any(gam>7|gam<1)) 
066     disp('Warning: gamma is outside the valid range') 
067     disp('The validity of the parameters returned are questionable') 
068   end 
069 end 
070  
071 if strncmpi(dim,'t',1)     
072   % LS fit to data 
073   % best fit to jonswap for gamma = 1:.5:7 
074   A0 =-0.00768035933493*gam +  1.12723230522407; 
075   B0 =-0.02261969635571*gam +  2.31625911055348; 
076   C0 = -0.00808703761189*gam +  0.14438532196018;  
077 else % not implemented yet 
078    
079   A0 = []; 
080   B0 = []; 
081   C0 = []; 
082 end 
083  
084 return 
085  
086 A0 = -0.01243795213128.*gam + 1.08025514722235; 
087 B0 = -0.03043834819688.*gam + 2.27161821064622; 
088 C0 = -0.01342959276544.*gam + 0.10353423379696;

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