function y = cnd(x) % pr = cnd(nd) % computes the probability that a variable will be less % than x standard deviations % example: pr = cnd(1.5) % copyright, 1995, William F. Sharpe % wfsharpe@leland.stanford.edu % this version Nov. 2, 1995 if x > 0 y = 0.5 + erf(x/sqrt(2))/2; else y = 0.5 - erf(-x/sqrt(2))/2; end