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)
 
  See also  wggampdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

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 %
019 % See also  wggampdf
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.
030 % added ms 26.06.2000
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