Home > wafo > wstats > wnormcdf.m

# wnormcdf

## PURPOSE

Normal cumulative distribution function

## SYNOPSIS

F = wnormcdf(x,m,v);

## DESCRIPTION

``` WNORMCDF Normal cumulative distribution function

CALL:  F = wnormcdf(x,m,v);

F = distribution function evaluated at x
m = mean     (default 0)
v = variance (default 1)

Example:
x = linspace(-3,3,200);
p1 = wnormcdf(x,0,1); p2 = wnormcdf(x,.5,0.25);
plot(x,p1,x,p2)```

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. erfc Complementary error function. error Display message and abort function. nan Not-a-Number.
This function is called by:
 chitwo2lc_sp Saddlepoint approximation of the crossing intensity for the noncentral Chi^2 process f_ar Auxiliary function used by RFCDEMO1 lomaxcdf CDF for local maxima for a zero-mean Gaussian process mvnormpcprb Multivariate Normal probabilities with product correlation ochi98cdf Ochi's (1998) CDF of peaks and troughs of non-gaussian processes ochi98pdf Ochi's (1998) PDF of peaks and troughs of non-gaussian processes specq2lc Saddlepoint approximation of the crossing intensity for the quadratic sea. wgumbtest Tests whether the shape parameter in a GEV is equal to zero winvgcdf Inverse Gaussian cumulative distribution function wlogncdf Lognormal cumulative distribution function wnormfit Parameter estimates for Normal data. wnorminv Inverse of the Normal distribution function wtcdf Student's T cumulative distribution function

## SOURCE CODE

```001 function F = wnormcdf(x,m,v);
002 %WNORMCDF Normal cumulative distribution function
003 %
004 % CALL:  F = wnormcdf(x,m,v);
005 %
006 %        F = distribution function evaluated at x
007 %        m = mean     (default 0)
008 %        v = variance (default 1)
009 %
010 % Example:
011 %   x = linspace(-3,3,200);
012 %   p1 = wnormcdf(x,0,1); p2 = wnormcdf(x,.5,0.25);
013 %   plot(x,p1,x,p2)
014
015
016 % Tested on; Matlab 5.3
017 % History:
018 % revised pab 23.03.2003
019 % -changed call from erf to erfc in order
020 %  to get more accurate lower probabilities
021 % -added a fix up for a bug in erfcore
022 % revised pab 24.10.2000
023 %  - added comnsize, nargchk
024 %  - added default values
026
027 error(nargchk(1,3,nargin))
028 if nargin<2|isempty(m),  m=0;  end
029 if nargin<3|isempty(v),  v=1;  end
030
031 [errorcode, x, m, v] = comnsize (x,m, v);
032 if (errorcode > 0)
033   error ('x, m and v must be of common size or scalar');
034 end
035
036 F=zeros(size(x));
037
038 k = find (v>0);
039 if any(k)
040   z    = -(x(k)-m(k))./sqrt(2*v(k));
041   F(k) = 0.5.*erfc(z);
042   % fix up for a bug in erfcore (Matlab R11 and earlier)
043   F(k(isnan(z))) = NaN;
044 end
045
046 k1 = find (v<=0);
047 if any (k1)
048   tmp=NaN;
049   F(k1) = tmp(ones(size(k1)));
050 end
051```

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