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

    %% Compute the Negative Binomial Distribution pdf
%

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the pdf of a negative binomial distribution with parameters |R =
% 3| and |p = 0.5|.
x = (0:10);
y = nbinpdf(x,3,0.5);

%%
% Plot the pdf.
figure;
plot(x,y,'+')
xlim([-0.5,10.5])