Home > wafo > wstats > wweibpdf.m

wweibpdf

PURPOSE ^

Weibull probability density function

SYNOPSIS ^

f = wweibpdf(x,a,c)

DESCRIPTION ^

 WWEIBPDF Weibull probability density function
 
  CALL:  f = wweibpdf(x,a,c);
 
         f = density function evaluated at x
      a, c = parameters
 
  The Weibull distribution is defined by its cdf
 
   F(x;a,c) = 1 -  exp(-(x/a)^c), x>=0, a,b>0
 
    Some references refer to the Weibull distribution with
    a single parameter, this corresponds to WWEIBPDF with a = 1.
 
  Example: 
    x = linspace(0,6,200);
    p1 = wweibpdf(x,1,1); p2 = wweibpdf(x,2,2); p3 = wweibpdf(x,2,5);
    plot(x,p1,x,p2,x,p3)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function f = wweibpdf(x,a,c)
002 %WWEIBPDF Weibull probability density function
003 %
004 % CALL:  f = wweibpdf(x,a,c);
005 %
006 %        f = density function evaluated at x
007 %     a, c = parameters
008 %
009 % The Weibull distribution is defined by its cdf
010 %
011 %  F(x;a,c) = 1 -  exp(-(x/a)^c), x>=0, a,b>0
012 %
013 %   Some references refer to the Weibull distribution with
014 %   a single parameter, this corresponds to WWEIBPDF with a = 1.
015 %
016 % Example: 
017 %   x = linspace(0,6,200);
018 %   p1 = wweibpdf(x,1,1); p2 = wweibpdf(x,2,2); p3 = wweibpdf(x,2,5);
019 %   plot(x,p1,x,p2,x,p3)
020 
021 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
022 % and Life Span Models", p. 25 ff, Marcel Dekker.
023 
024 
025 % Tested on; Matlab 5.3
026 % History: 
027 % revised pab 24.10.2000
028 %  - added comnsize, nargchk
029 % rewritten ms 15.06.2000
030 
031 
032 error(nargchk(3,3,nargin))
033 
034 [errorcode, x, a, c] = comnsize (x,a, c);
035 if (errorcode > 0)
036   error ('x, a and c must be of common size or scalar');
037 end
038 
039 f=zeros(size(x));
040 
041 ok = ((c > 0)  & (a > 0));
042 
043 k = find (x>=0&ok);
044 if any (k)  
045   f(k)=(x(k)./a(k)).^(c(k)-1).*c(k)./a(k).*exp(-(x(k)./a(k)).^c(k));
046 end
047 
048 k1 = find (~ok);
049 if any (k1)
050   tmp=NaN;
051   f(k1) = tmp(ones(size(k1)));
052 end
053 
054 
055 
056 
057 
058 
059

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