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

    %% Compute the Gamma Distribution pdf
%

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the pdf of a gamma distribution with parameters |A = 100| and 
% |B = 10|. For comparison, also compute the pdf of a normal distribution
% with parameters |mu = 1000| and |sigma = 100|.
x = gaminv((0.005:0.01:0.995),100,10);
y = gampdf(x,100,10);
y1 = normpdf(x,1000,100);

%%
% Plot the pdfs of the gamma distribution and the normal distribution on
% the same figure.
figure;
plot(x,y,'-',x,y1,'-.')