Home > wafo > wavemodels > thwparfun.m

thwparfun

PURPOSE ^

Wave height, Hd, distribution parameters for Torsethaugen spectra.

SYNOPSIS ^

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

DESCRIPTION ^

 THWPARFUN Wave height, Hd, distribution parameters for Torsethaugen spectra. 
  
  CALL [a b c] = thwparfun(Hm0,Tp,dim) 
  
  Hm0 = significant wave height [m]. 
  Tp  = peak period [s] 
  dim = 'time'  : Hd distribution parameters in time (default) 
  
   THWPARFUN 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  
   Torsethaugen spectral density (torsethaugen).   
  
   The empirical parameters of the model is fitted by 
   least squares to simulated Hd data for 600 classes of Hm0 and Tp. 
   Between 50000 and 150000 zero-downcrossing waves were simulated for 
   each class of Hm0 and Tp for DIM=='time'. 
   THWPARFUN is restricted to the following range for Hm0 and Tp:  
   0.5 < Hm0 [m] < 12,  3.5 < Tp [s] < 20,  and  Hm0 < (Tp-2)*12/11. 
   
   Example: 
   Hm0 = 6;Tp = 8;Hrms = Hm0/sqrt(2); 
   [a b c] = thwparfun(Hm0,Tp); 
   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 = torsethaugen(w,[Hm0 Tp]); 
   xs = spec2sdat(S,20000,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  thpdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [A0,B0,C0]= thwparfun(Hm0,Tp,dim) 
002 %THWPARFUN Wave height, Hd, distribution parameters for Torsethaugen spectra. 
003 % 
004 % CALL [a b c] = thwparfun(Hm0,Tp,dim) 
005 % 
006 % Hm0 = significant wave height [m]. 
007 % Tp  = peak period [s] 
008 % dim = 'time'  : Hd distribution parameters in time (default) 
009 % 
010 %  THWPARFUN returns the truncated Weibull distribution parameters which 
011 %  approximates the marginal PDF of Hd/Hrms, i.e., 
012 %  zero-downcrossing wave height, for a Gaussian process with a  
013 %  Torsethaugen spectral density (torsethaugen).   
014 % 
015 %  The empirical parameters of the model is fitted by 
016 %  least squares to simulated Hd data for 600 classes of Hm0 and Tp. 
017 %  Between 50000 and 150000 zero-downcrossing waves were simulated for 
018 %  each class of Hm0 and Tp for DIM=='time'. 
019 %  THWPARFUN is restricted to the following range for Hm0 and Tp:  
020 %  0.5 < Hm0 [m] < 12,  3.5 < Tp [s] < 20,  and  Hm0 < (Tp-2)*12/11. 
021 %  
022 %  Example: 
023 %  Hm0 = 6;Tp = 8;Hrms = Hm0/sqrt(2); 
024 %  [a b c] = thwparfun(Hm0,Tp); 
025 %  h = linspace(0,4*Hrms)';  
026 %  F = wtweibcdf(h/Hrms,a,b,c); 
027 %  f = wtweibpdf(h/Hrms,a,b,c)/Hrms; 
028 %  dt = 0.4; w = linspace(0,2*pi/dt,256)'; 
029 %  S = torsethaugen(w,[Hm0 Tp]); 
030 %  xs = spec2sdat(S,20000,dt); rate=8; method=1; 
031 %  [S,H] = dat2steep(xs,rate,method); 
032 %  fk = kdebin(H,'epan',[],[],.5,128); 
033 %  subplot(2,1,1) 
034 %  empdistr(H,[h,F],1) 
035 %  subplot(2,1,2 
036 %  plot(h,f), hold on, pdfplot(fk,'r'), hold off 
037 %  
038 %  See also  thpdf  
039  
040 % Reference   
041 % P. A. Brodtkorb (2004),   
042 % The Probability of Occurrence of Dangerous Wave Situations at Sea. 
043 % Dr.Ing thesis, Norwegian University of Science and Technolgy, NTNU, 
044 % Trondheim, Norway. 
045    
046 % History: 
047 % revised pab 7-Jan-2004   
048 % by pab 29.11.2002 
049  
050 error(nargchk(2,3,nargin)) 
051 if nargin<3|isempty(dim), dim = 'time';end 
052  
053 displayWarning = 0; 
054 if displayWarning 
055   if  Hm0<0.5 | 12<Hm0 
056     disp('Warning: Hm0 is outside the valid range') 
057     disp('The validity of the parameters returned are questionable') 
058   end 
059   if Tp<3.5 | 20<Tp 
060     disp('Warning: Tp is outside the valid range') 
061     disp('The validity of the parameters returned are questionable') 
062   end 
063  
064   if Hm0 > (Tp-2)*12/11 
065     disp('Warning: Hm0 is too large compared to Tp!') 
066     disp('The validity of the parameters returned are questionable') 
067   end 
068 end 
069  
070 if strcmpi(dim(1),'t'), % Waveheight distribution in time 
071   global THWPAR 
072   if isempty(THWPAR) 
073     %THWPAR = load('thwpar.mat'); 
074     THWPAR = load('thwnlpar20-Jul-2004.mat'); 
075   end 
076   % Truncated Weibull  distribution parameters as a function of Tp, Hm0  
077   A00 = THWPAR.A00s; 
078   B00 = THWPAR.B00s; 
079   C00 = THWPAR.C00s; 
080  
081   Tpp  = THWPAR.Tp; 
082   Hm00 = THWPAR.Hm0; 
083   [E1, H1] = meshgrid(Tpp,Hm00); 
084   method = '*cubic'; 
085   A0 = interp2(E1,H1,A00,Tp,Hm0,method); 
086   B0 = interp2(E1,H1,B00,Tp,Hm0,method); 
087   C0 = interp2(E1,H1,C00,Tp,Hm0,method); 
088 else  
089   % % Waveheight distribution in space not available 
090   %  disp('Waveheight distribution parameters in space not available') 
091   %  disp('for truncated weibull distribution.') 
092   %  disp('Corresponding distribution parameters is available for the gamma') 
093   %  disp('distribution in thgparfun!') 
094    
095   global THSSPARW 
096   if isempty(THSSPARW) 
097     THSSPARW = load('thsspar27-Jul-2004.mat'); 
098   end 
099    % truncated Weibul distribution parameters as a function of Tp, Hm0  
100    A00 = THSSPARW.A00s; 
101    B00 = THSSPARW.B00s; 
102    C00 = THSSPARW.C00s; 
103    Tpp  = THSSPARW.Tp; 
104    Hm00 = THSSPARW.Hm0; 
105    [E1, H1] = meshgrid(Tpp,Hm00); 
106    method = '*cubic'; 
107     
108    %A0 = repmat('nan',Hm0);  B0 = A0;  C0 = A0; 
109    
110    A0 = interp2(E1,H1,A00,Tp,Hm0,method); 
111    B0 = interp2(E1,H1,B00,Tp,Hm0,method); 
112    C0 = interp2(E1,H1,C00,Tp,Hm0,method); 
113 end 
114

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