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

    %% Compute the Normal Distribution icdf

% 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 _y_ to contain the probability values at which to
% calculate the icdf.
y = [0.1,0.25,0.5,0.75,0.9];

%%
% Compute the icdf values for the standard normal distribution at the
% values in _y_.
x = icdf(pd,y)

%%
% Each value in _x_ corresponds to a value in the input vector _y_. For
% example, at the value _y_ equal to 0.9, the corresponding icdf value _x_
% is equal to 1.2816.

%%
% Alternatively, you can compute the same icdf values without creating a
% probability distribution object. Use the |icdf| function and specify a
% standard normal distribution using the same parameter values for $\mu$ and
% $\sigma$.
x2 = icdf('Normal',y,mu,sigma)

%%
% The icdf values are the same as those computed using the probability
% distribution object.