function phi=stdnormcdf(z) % stdnormcdf(z) calculates the value of the standard normal % cumulative distribution function at z, % using the built-in MATLAB error function erf; % see Abramowitz and Stegun, 1964, Handbook of Mathematical Functions, % Dover, New York, equation 7.1.22 phi=0.5*(1 + (erf(z/sqrt(2))));