www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/PlotErrorFunctionExample.m

    %% Find Cumulative Distribution Function of Normal Distribution
% The cumulative distribution function (CDF) of the normal, or Gaussian,
% distribution with standard deviation $\sigma$ and mean $\mu$ is
% 
% $$\phi(x) = \frac{1}{2} \biggl(1+\rm erf\Bigl(
% \frac{x-\mu}{\sigma\sqrt{2}}\Bigr)\biggr).$$
% 
% Note that for increased computational accuracy, you can rewrite the
% formula in terms of |erfc| . For details, see 
% <docid:matlab_ref.bup2mn8-5>.
% 
% Plot the CDF of the normal distribution with $\mu=0$ and $\sigma=1$.

% Copyright 2015 The MathWorks, Inc.

x = -3:0.1:3;
y = (1/2)*(1+erf(x/sqrt(2)));
plot(x,y)
grid on
title('CDF of normal distribution with \mu = 0 and \sigma = 1')
xlabel('x')
ylabel('CDF')