Home > wafo > wstats > wfrechcdf.m

# wfrechcdf

## PURPOSE

Frechet cumulative distribution function

## SYNOPSIS

F = wfrechcdf(x,a,c)

## DESCRIPTION

``` WFRECHCDF Frechet cumulative distribution function

CALL:  F = wfrechcdf(x,a,c);

F = density function evaluated at x
a, c = parameters

The Frechet distribution is defined by its cdf

F(x;a,c) = exp(-(x/a)^(-c)), x>=0, a,c>0

Example:
x = linspace(0,6,200);
F1 = wfrechcdf(x,1,1); F2 = wfrechcdf(x,2,2); F3 = wfrechcdf(x,2,5);
plot(x,p1,x,F2,x,F3)```

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

## SOURCE CODE

```001 function F = wfrechcdf(x,a,c)
002 %WFRECHCDF Frechet cumulative distribution function
003 %
004 % CALL:  F = wfrechcdf(x,a,c);
005 %
006 %        F = density function evaluated at x
007 %     a, c = parameters
008 %
009 % The Frechet distribution is defined by its cdf
010 %
011 %  F(x;a,c) = exp(-(x/a)^(-c)), x>=0, a,c>0
012 %
013 % Example:
014 %   x = linspace(0,6,200);
015 %   F1 = wfrechcdf(x,1,1); F2 = wfrechcdf(x,2,2); F3 = wfrechcdf(x,2,5);
016 %   plot(x,p1,x,F2,x,F3)
017
018 % Reference:
019
020 % Tested on; Matlab 5.3
021 % History:
023
024
025 error(nargchk(3,3,nargin))
026
027 [errorcode, x, a, c] = comnsize (x,a, c);
028 if (errorcode > 0)
029   error ('x, a and c must be of common size or scalar');
030 end
031
032 F=zeros(size(x));
033
034 ok = ((c > 0)  & (a > 0));
035
036 k = find (x>=0&ok);
037 if any (k)
038   F(k)=exp(-(x(k)./a(k)).^(-c(k)));
039 end
040
041 k1 = find (~ok);
042 if any (k1)
043   tmp=NaN;
044   F(k1) = tmp(ones(size(k1)));
045 end
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