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

    %% Fit a Burr Distribution and Draw the cdf  
% This example shows how to fit a Burr distribution to data, draw the cdf,
% and construct a histogram with a Burr distribution fit.   

%% 
% 1. Load the sample data. 
load arrhythmia

%%
% The fifth column in |X| contains a measurement obtained from electrocardiograms,
% called QRS duration.  

%% 
% 2. Fit a Burr distribution to the QRS duration data, and get the parameter
% estimates. 
PD = fitdist(X(:,5),'burr'); 

%%
% |PD| has the maximum likelihood estimates of the Burr distribution parameters
% in the property |Param|. The estimates are α = 80.4515, $c$ = 18.9251,
% $k$ = 0.4492.  

%% 
% 3. Plot the cdf of the QRS duration data. 
QRScdf=cdf('burr',sortrows(X(:,5)),80.4515,18.9251,0.4492);
plot(sortrows(X(:,5)),QRScdf) 
title('QRS duration data')
xlabel('QRS Duration')

%% 
% 4. Draw the histogram of QRS duration data with 15 bins and the pdf of
% the Burr distribution fit. 
histfit(X(:,5),15,'burr')
title('Histogram of QRS data with a Burr distribution fit')
xlabel('QRS Duration')