OCHI98CDF Ochi's (1998) CDF of peaks and troughs of non-gaussian processes CALL: F = ochi98cdf(x,A1,A2) F = CDF x = quantiles A1, A2 = scale parameters for troughs and crests, respectively. where A1 = sqrt(2*s1^2/(1-(.4*(c1/s1)^2) A2 = sqrt(2*s2^2/(1-(.4*(c2/s2)^2) si = sigmai/(1+L2 The size of F is the common size of X, A1 and A2. A scalar input functions as a constant matrix of the same size as the other input. Example: x =linspace(0,10).'; a1 = 2.5; a2 = 2; plot(x,ochi98cdf(x,a1,a2),x,wraylcdf(x,sqrt(a1^2+a2^2))) See also wnormcdf, wraylcdf
Normal cumulative distribution function | |
Rayleigh cumulative distribution function | |
Check if all input arguments are either scalar or of common size. | |
Display message and abort function. | |
Not-a-Number. |
001 function y = ochi98cdf(x,a,b) 002 %OCHI98CDF Ochi's (1998) CDF of peaks and troughs of non-gaussian processes 003 % 004 % CALL: F = ochi98cdf(x,A1,A2) 005 % 006 % F = CDF 007 % x = quantiles 008 % A1, A2 = scale parameters for troughs and crests, respectively. 009 % where 010 % A1 = sqrt(2*s1^2/(1-(.4*(c1/s1)^2) 011 % A2 = sqrt(2*s2^2/(1-(.4*(c2/s2)^2) 012 % si = sigmai/(1+L2 013 % 014 % The size of F is the common size of X, A1 and A2. A scalar input 015 % functions as a constant matrix of the same size as the other input. 016 % 017 % Example: 018 % x =linspace(0,10).'; a1 = 2.5; a2 = 2; 019 % plot(x,ochi98cdf(x,a1,a2),x,wraylcdf(x,sqrt(a1^2+a2^2))) 020 % 021 % See also wnormcdf, wraylcdf 022 023 024 025 % Reference: 026 % [1] Michel K. Ochi, (1998) 027 % "Probability distributions of peaks and troughs of non-gaussian processes" 028 % Probabilistic Engineering Mechanics, Vol 13, No 4, pp 291-298 029 030 % tested on: 031 % history: 032 % revised pab 29.02.2000 033 % changed name to ochi98cdf 034 % Per A. Brodtkorb 17.02.99 035 036 % TODO % needs explanation to the scaling 037 if nargin < 3, 038 error('Requires at least three input arguments.'); 039 end 040 041 [errorcode x a b] = comnsize(x,a,b); 042 043 if errorcode > 0 044 error('Requires non-scalar arguments to match in size.'); 045 end 046 047 % Initialize Y to zero. 048 y=zeros(size(x)); 049 050 % Return NaN if A or B is not positive. 051 k1 = find(a <= 0|b<= 0); 052 if any(k1) 053 tmp = NaN; 054 y(k1) = tmp(ones(size(k1))); 055 end 056 057 k=find(a > 0 & b>0 & x > 0 & x < inf); 058 if any(k), 059 r1 = a(k).^2; r2 = b(k).^2;xk = x(k); 060 y(k)=1-1./(r1+r2).*(r1.*exp(-xk.^2./r1)+ r2.*exp(-xk.^2./r2)+... 061 2*xk.*sqrt(pi*r1.*r2./(r1+r2)).*exp(-xk.^2./(r1+r2))... 062 .*(wnormcdf(sqrt(2*r2./r1./(r1+r2)).*xk ) - wnormcdf(-sqrt(2*r1./r2./(r1+r2)).*xk ) )); 063 end 064 065 k=find(a > 0 & (b==0 | a==b)); 066 if any(k), 067 y(k)=wraylcdf(x(k),a(k)/sqrt(2)); 068 end 069 k=find(a == 0 & b>0); 070 if any(k), 071 y(k)=wraylcdf(x(k),b(k)/sqrt(2)); 072 end 073 k=find(b == 0 & a>0); 074 if any(k), 075 y(k)=wraylcdf(x(k),a(k)/sqrt(2)); 076 end 077 k=find(a > 0 & b>0 & x ==inf); 078 if any(k), 079 y(k)=ones(size(y(k))); 080 end 081
Comments or corrections to the WAFO group