Home > wafo > wstats > wgampdf.m

wgampdf

PURPOSE

Gamma probability density function

SYNOPSIS

f = wgampdf(x,a,b);

DESCRIPTION

``` WGAMPDF Gamma probability density function

CALL:  f = wgampdf(x,a,b);

f = density function evaluated at x
a = parameter
b = parameter (default b=1)

The Gamma distribution is defined by its pdf

f(x)=x^(a-1)*exp(-x/b)/gamma(a)/b^a, a,b>0, x>=0.

Example:
x = linspace(0,7,200);
p1 = wgampdf(x,1); p2 = wgampdf(x,2);
plot(x,p1,x,p2)

CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wggampdf Generalized Gamma probability density function error Display message and abort function.
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) mdist2dpdf Joint 2D PDF due to Plackett given as f{x1}*f{x2}*G(x1,x2;Psi). thsnlpdf Joint (Scf,Hd) PDF for nonlinear waves with Torsethaugen spectra. thspdf Joint (Scf,Hd) PDF for linear waves with Torsethaugen spectra. thspdf2 Joint (Scf,Hd) PDF for linear waves with Torsethaugen spectra. thsspdf Joint (Scf,Hd) PDF for linear waves in space with Torsethaugen spectra. wgaminv Inverse of the Gamma distribution function wggaminv Inverse of the Generalized Gamma distribution function

SOURCE CODE

```001 function f = wgampdf(x,a,b);
002 %WGAMPDF Gamma probability density function
003 %
004 % CALL:  f = wgampdf(x,a,b);
005 %
006 %        f = density function evaluated at x
007 %        a = parameter
008 %        b = parameter (default b=1)
009 %
010 % The Gamma distribution is defined by its pdf
011 %
012 %        f(x)=x^(a-1)*exp(-x/b)/gamma(a)/b^a, a,b>0, x>=0.
013 %
014 % Example:
015 %   x = linspace(0,7,200);
016 %   p1 = wgampdf(x,1); p2 = wgampdf(x,2);
017 %   plot(x,p1,x,p2)
018 %
020
021 % Reference: Johnson, Kotz and Balakrishnan (1994)
022 % "Continuous Univariate Distributions, vol. 1", p. 494 ff
023 % Wiley
024
025 % Tested on; Matlab 5.3
026 % History:
027 % revised pab 24.10.2000
028 %  - added comnsize, nargchk
029 %  - replaced code with a call to wggampdf -> maintainance easier.
031 % added b parameter ms 23.08.2000
032
033 error(nargchk(2,3,nargin))
034
035 if nargin<3|isempty(b),  b=1; end
036
037 [errorcode x a b c] = comnsize(x,a,b,1);
038
039 if errorcode > 0
040   error('x, a and b must be of common size or scalar.');
041 end
042 f = wggampdf(x,a,b,c);
043
044
045
046```

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