WLOGNPDF Lognormal probability density function CALL: f = wlognpdf(x,m,s); f = density function evaluated at x m = mean of log(x) (default 0) v = variance of log(x) (default 1) The Lognormal distribution is defined by its pdf f(x) = exp(-(log(x)-m)^2/(2*v))/sqrt(v*2*pi*x^2), x>=0. Example: x = linspace(0,3,200); p1 = wlognpdf(x,0,1); p2 = wlognpdf(x,.5,0.25); plot(x,p1,x,p2)
Check if all input arguments are either scalar or of common size. | |
Display message and abort function. | |
Not-a-Number. |
is an internal function to dist2dcdf dist2dprb. | |
Joint 2D PDF computed as f(x1|X2=x2)*f(x2) | |
Long Term Wave Climate PDF of significant wave height and wave period | |
Joint 2D PDF due to Plackett given as f{x1}*f{x2}*G(x1,x2;Psi). | |
Myrhaug and Kjeldsen (1987) joint (Scf,Hd) PDF. |
001 function f = wlognpdf(x,m,v); 002 %WLOGNPDF Lognormal probability density function 003 % 004 % CALL: f = wlognpdf(x,m,s); 005 % 006 % f = density function evaluated at x 007 % m = mean of log(x) (default 0) 008 % v = variance of log(x) (default 1) 009 % 010 % The Lognormal distribution is defined by its pdf 011 % 012 % f(x) = exp(-(log(x)-m)^2/(2*v))/sqrt(v*2*pi*x^2), x>=0. 013 % 014 % Example: 015 % x = linspace(0,3,200); 016 % p1 = wlognpdf(x,0,1); p2 = wlognpdf(x,.5,0.25); 017 % plot(x,p1,x,p2) 018 019 020 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability 021 % and Life Span Models", p. 59 ff, Marcel Dekker. 022 023 % Tested on; Matlab 5.3 024 % History: 025 % revised pab 24.10.2000 026 % - added comnsize, nargchk 027 % - added default values 028 % - fixed a bug in the parameterization 029 % added ms 10.08.2000 030 031 error(nargchk(1,3,nargin)) 032 if nargin<2|isempty(m), m=0; end 033 if nargin<3|isempty(v), v=1; end 034 035 [errorcode, x, m, v] = comnsize (x,m, v); 036 if (errorcode > 0) 037 error ('x, m and v must be of common size or scalar'); 038 end 039 040 f=zeros(size(x)); 041 042 k = find (x>0&v>0); 043 if any(k) 044 f(k)=1./sqrt(2*pi*v(k)).*exp(-0.5*(log(x(k))-m(k)).^2./v(k))./x(k); 045 end 046 047 k1 = find (v<=0); 048 if any (k1) 049 tmp=NaN; 050 f(k1) = tmp(ones(size(k1))); 051 end 052 053 054 055 056
Comments or corrections to the WAFO group