www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeTheNormalDistributionCdfExample.m
%% Compute the Normal Distribution cdf % Copyright 2015 The MathWorks, Inc. %% % Create a standard normal distribution object with the mean, $\mu$, equal % to 0 and the standard deviation, $\sigma$, equal to 1. mu = 0; sigma = 1; pd = makedist('Normal',mu,sigma); %% % Define the input vector _x_ to contain the values at which to calculate % the cdf. x = [-2,-1,0,1,2]; %% % Compute the cdf values for the standard normal distribution at the values % in _x_. y = cdf(pd,x) %% % Each value in _y_ corresponds to a value in the input vector _x_. For % example, at the value _x_ equal to 1, the corresponding cdf value _y_ is % equal to 0.8413. %% % Alternatively, you can compute the same cdf values without creating a % probability distribution object. Use the |cdf| function, and specify a % standard normal distribution using the same parameter values for $\mu$ % and $\sigma$. y2 = cdf('Normal',x,mu,sigma) %% % The cdf values are the same as those computed using the probability % distribution object.