JHSPDF2 Joint (Scf,Hd) PDF for linear waves with a JONSWAP spectrum. CALL: f = jhspdf2(Hd,Scf,Hm0,Tp,gamma) f = pdf struct evaluated at meshgrid(Scf,Hd) Hd = zero down crossing wave height Scf = crest front steepness Hm0 = significant wave height Tp = Spectral peak period Gamma = Peakedness parameter of the JONSWAP spectrum JHSPDF2 approximates the joint distribution of (Scf, Hd), i.e., crest front steepness (2*pi*Ac/(g*Td*Tcf)) and wave height, for a Gaussian process with a JONSWAP spectral density. The empirical parameters of the model is fitted by least squares to simulated (Scf,Hd) data for 13 classes of GAMMA between 1 and 7. Between 47000 and 55000 zero-downcrossing waves were simulated for each class. JHSPDF2 is restricted to the following range for GAMMA: 1 <= GAMMA <= 7 Example: Hm0 = 6;Tp = 9; gam=3.5 h = linspace(0,4*Hm0/sqrt(2))'; s = linspace(0,6*1.25*Hm0/Tp^2)'; f = jhspdf2(h,s,Hm0,Tp,gam); w = linspace(0,40,5*1024+1).'; S = jonswap(w,[Hm0, Tp, gam]); dt = .3; x = spec2sdat(S,80000,dt); rate = 4; [si,hi] = dat2steep(x,rate,2); fk = kdebin([si,hi],'epan',[],[],.5,128); fk.title = f.title; fk.labx = f.labx; plot(si,hi,'.'), hold on pdfplot(f),pdfplot(fk,'r'),hold off See also jhspdf
PDF class constructor | |
Peakedness factor Gamma given Hm0 and Tp for JONSWAP | |
Joint (Scf,Hd) PDF for linear waves with JONSWAP spectra. | |
Calculates quantile levels which encloses P% of PDF | |
Display message and abort function. | |
X and Y arrays for 3-D plots. | |
Convert number to string. (Fast version) |
001 function [f,Hrms,Srms,fA,fB] = jhspdf2(Hd,Scf,Hm0,Tp,gam,normalizedInput) 002 %JHSPDF2 Joint (Scf,Hd) PDF for linear waves with a JONSWAP spectrum. 003 % 004 % CALL: f = jhspdf2(Hd,Scf,Hm0,Tp,gamma) 005 % 006 % f = pdf struct evaluated at meshgrid(Scf,Hd) 007 % Hd = zero down crossing wave height 008 % Scf = crest front steepness 009 % Hm0 = significant wave height 010 % Tp = Spectral peak period 011 % Gamma = Peakedness parameter of the JONSWAP spectrum 012 % 013 % JHSPDF2 approximates the joint distribution of (Scf, Hd), i.e., crest 014 % front steepness (2*pi*Ac/(g*Td*Tcf)) and wave height, for a Gaussian 015 % process with a JONSWAP spectral density. The empirical parameters of 016 % the model is fitted by least squares to simulated (Scf,Hd) data for 13 017 % classes of GAMMA between 1 and 7. Between 47000 and 55000 018 % zero-downcrossing waves were simulated for each class. 019 % JHSPDF2 is restricted to the following range for GAMMA: 020 % 1 <= GAMMA <= 7 021 % 022 % Example: 023 % Hm0 = 6;Tp = 9; gam=3.5 024 % h = linspace(0,4*Hm0/sqrt(2))'; 025 % s = linspace(0,6*1.25*Hm0/Tp^2)'; 026 % f = jhspdf2(h,s,Hm0,Tp,gam); 027 % w = linspace(0,40,5*1024+1).'; 028 % S = jonswap(w,[Hm0, Tp, gam]); 029 % dt = .3; 030 % x = spec2sdat(S,80000,dt); rate = 4; 031 % [si,hi] = dat2steep(x,rate,2); 032 % fk = kdebin([si,hi],'epan',[],[],.5,128); 033 % fk.title = f.title; fk.labx = f.labx; 034 % plot(si,hi,'.'), hold on 035 % pdfplot(f),pdfplot(fk,'r'),hold off 036 % 037 % See also jhspdf 038 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 error(nargchk(3,6,nargin)) 047 048 if (nargin < 6|isempty(normalizedInput)), normalizedInput = 0;end 049 if (nargin < 4|isempty(Tp)), Tp = 8;end 050 if (nargin < 3|isempty(Hm0)), Hm0 = 6;end 051 if (nargin < 5|isempty(gam)) 052 gam = getjonswappeakedness(Hm0,Tp); 053 end 054 displayWarning = 1; 055 if displayWarning 056 if any(any(Tp>5*sqrt(Hm0) | Tp<3.6*sqrt(Hm0))) 057 disp('Warning: Hm0,Tp is outside the JONSWAP range') 058 disp('The validity of the parameters returned are questionable') 059 end 060 end 061 062 [V,H] = meshgrid(Scf,Hd); 063 064 f = createpdf(2); 065 [f.f,Hrms,Srms,varargout{1:nargout-1}] = jhspdf(H,V,Hm0,Tp,gam,normalizedInput); 066 f.x = {Scf(:),Hd(:)}; 067 068 if (normalizedInput) 069 f.labx = {'Scf', 'Hd'}; 070 f.norm = 1; 071 else 072 f.norm = 0; 073 f.labx = {'Scf [m/s]', 'Hd [m]'}; 074 end 075 f.title = 'Joint distribution of (Hd,Scf) in time'; 076 f.note = ['Jonswap Hm0=' num2str(Hm0) ' Tp = ' num2str(Tp) ' Gamma = ' num2str(gam)]; 077 [f.cl,f.pl] = qlevels(f.f); 078 return 079
Comments or corrections to the WAFO group