Home > wafo > wstats > wraylpdf.m

wraylpdf

PURPOSE

Rayleigh probability density function

SYNOPSIS

f = wraylpdf(x,b);

DESCRIPTION

``` WRAYLPDF Rayleigh probability density function

CALL:  f = wraylpdf(x,b);

f = density function evaluated at x
b = parameter

The Rayleigh distribution is defined by its cdf

F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0, b>0

Example:
x = linspace(0,4,200);
p1 = wraylpdf(x,1); p2 = wraylpdf(x,0.5);
plot(x,p1,x,p2)```

CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. error Display message and abort function. nan Not-a-Number.
This function is called by:
 b04jpdf Brodtkorb (2004) joint (Scf,Hd) PDF from Japan Sea. b04pdf Brodtkorb (2004) joint (Scf,Hd) PDF of laboratory data. bmr00pdf Brodtkorb et.al (2000) joint (Scf,Hd) PDF from North Sea. dist2dfun is an internal function to dist2dcdf dist2dprb. dist2dpdf Joint 2D PDF computed as f(x1|X2=x2)*f(x2) kdedemo2 Demonstrate the difference between transformation- and ordinary-KDE mdist2dpdf Joint 2D PDF due to Plackett given as f{x1}*f{x2}*G(x1,x2;Psi). ochi98pdf Ochi's (1998) PDF of peaks and troughs of non-gaussian processes tay81pdf Tayfun (1981) PDF of breaking limited wave heights tay90pdf Tayfun (1990) PDF of large wave heights

SOURCE CODE

```001 function f = wraylpdf(x,b);
002 %WRAYLPDF Rayleigh probability density function
003 %
004 % CALL:  f = wraylpdf(x,b);
005 %
006 %        f = density function evaluated at x
007 %        b = parameter
008 %
009 % The Rayleigh distribution is defined by its cdf
010 %
011 %  F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0, b>0
012 %
013 % Example:
014 %   x = linspace(0,4,200);
015 %   p1 = wraylpdf(x,1); p2 = wraylpdf(x,0.5);
016 %   plot(x,p1,x,p2)
017
018 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
019 % and Life Span Models", p. 181 ff, Marcel Dekker.
020
021
022 % Tested on; Matlab 5.3
023 % History:
024 % revised pab 24.10.2000
025 %  - added comnsize, nargchk
027
028
029 error(nargchk(2,2,nargin))
030 [errorcode, x, b] = comnsize (x,b);
031 if (errorcode > 0)
032   error ('x and b must be of common size or scalar');
033 end
034
035 f=zeros(size(x));
036
037 k = find ((x>=0)&(b>0));
038 if any (k)
039   f(k)=x(k).*exp(-x(k).^2./(2*b(k).^2))./b(k).^2;
040 end
041
042 k1 = find (b<=0);
043 if any (k1)
044   tmp=NaN;
045   f(k1) = tmp(ones(size(k1)));
046 end
047
048```

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