www.gusucode.com > stats 源码程序 matlab案例代码 > stats/BetaDistributionParametersExample.m
%% Beta Distribution Parameters % Copyright 2015 The MathWorks, Inc. %% Fit Beta Distribution rng default % For reproducibility r = betarnd(5,0.2,100,1); [phat, pci] = betafit(r) %% Plot Beta Distribution Parameters X = 0:.01:1; y1 = betapdf(X,0.75,0.75); y2 = betapdf(X,1,1); y3 = betapdf(X,4,4); figure plot(X,y1,'Color','r','LineWidth',2) hold on plot(X,y2,'LineStyle','-.','Color','b','LineWidth',2) plot(X,y3,'LineStyle',':','Color','g','LineWidth',2) legend({'a = b = 0.75','a = b = 1','a = b = 4'},'Location','NorthEast'); hold off