Home > wafo > wstats > wtraylcdf.m

# wtraylcdf

## PURPOSE

Truncated Rayleigh cumulative distribution function

## SYNOPSIS

F = wraylcdf(x,b,c,a);

## DESCRIPTION

``` WTRAYLCDF Truncated Rayleigh cumulative distribution function

CALL:  F = wtraylcdf(x,b,c);

F = distribution function evaluated at x
b = scale parameter
c = truncation parameter (default 0)
The truncated Rayleigh distribution is defined by its cdf

F(x;b,c) = 1 - exp(-(x-c)^2/(2b^2)+c^2/(2b^2)), x>=0

Example:
x = linspace(0,4,200);
p1 = wtraylcdf(x,1); p2 = wtraylcdf(x,0.5,-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. error Display message and abort function. nan Not-a-Number.
This function is called by:
 wtraylfit Parameter estimates for Truncated Rayleigh data.

## SOURCE CODE

```001 function F = wraylcdf(x,b,c,a);
002 %WTRAYLCDF Truncated Rayleigh cumulative distribution function
003 %
004 % CALL:  F = wtraylcdf(x,b,c);
005 %
006 %        F = distribution function evaluated at x
007 %        b = scale parameter
008 %        c = truncation parameter (default 0)
009 % The truncated Rayleigh distribution is defined by its cdf
010 %
011 %  F(x;b,c) = 1 - exp(-(x-c)^2/(2b^2)+c^2/(2b^2)), x>=0
012 %
013 % Example:
014 %   x = linspace(0,4,200);
015 %   p1 = wtraylcdf(x,1); p2 = wtraylcdf(x,0.5,-2);
016 %   plot(x,p1,x,p2)
017
018 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
019 % and Life Span Models", p. 181 ff, Marcel Dekker.
020
021
022 % Tested on: Matlab 5.3
023 % History:
024 % by pab 03.12.2000
025 % based on wraylpdf
026
027 error(nargchk(2,4,nargin))
028 if nargin<3|isempty(c),c=0;end
029 if nargin<4|isempty(a),a=2;end
030 [errorcode, x, b,c] = comnsize (x,b,c);
031 if (errorcode > 0)
032   error ('x, b and c must be of common size or scalar');
033 end
034
035 F = zeros(size(x));
036
037 k = find ((x>=0)&(b>0));
038
039 if any(k)
040   F(k)=(1-exp(-(x(k)-c(k)).^a./(2*b(k).^a)+abs(c(k)).^a./(2*b(k).^a)));
041 end
042
043 k1 = find (b<=0);
044 if any(k1)
045   tmp=NaN;
046   F(k1) = tmp(ones(size(k1)));
047 end
048
049
050
051
052```

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