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

    %% Compute the Poisson Distribution cdf

% Copyright 2015 The MathWorks, Inc.


%%
% Create a Poisson distribution object with the rate parameter, $\lambda$,
% equal to 2.
lambda = 2;
pd = makedist('Poisson',lambda);

%%
% Define the input vector _x_ to contain the values at which to calculate
% the cdf.
x = [0,1,2,3,4];

%%
% Compute the cdf values for the Poisson 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 3, the corresponding cdf value _y_ is
% equal to 0.8571.

%%
% Alternatively, you can compute the same cdf values without creating a
% probability distribution object. Use the |cdf| function, and specify a
% Poisson distribution using the same value for the rate parameter,
% $\lambda$.
y2 = cdf('Poisson',x,lambda)

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