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:
 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:
 dist2dfun is an internal function to dist2dcdf dist2dprb. dist2dpdf Joint 2D PDF computed as f(x1|X2=x2)*f(x2) jhvnlpdf Joint (Vcf,Hd) PDF for linear waves with a JONSWAP spectrum. jhvpdf Joint (Vcf,Hd) PDF for linear waves with a JONSWAP spectrum. ltwcpdf Long Term Wave Climate PDF of significant wave height and wave period mdist2dpdf Joint 2D PDF due to Plackett given as f{x1}*f{x2}*G(x1,x2;Psi). mk87pdf Myrhaug and Kjeldsen (1987) joint (Scf,Hd) PDF. ohhspdf Joint (Scf,Hd) PDF for linear waves with Ochi-Hubble spectra. ohhsspdf Joint (Scf,Hd) PDF linear waves in space with Ochi-Hubble spectra. ohhvpdf Joint (Vcf,Hd) PDF for lineare waves with Ochi-Hubble spectra. thvpdf Joint (Vcf,Hd) PDF for linear waves with Torsethaugen spectra.

## 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