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

    %% Median of a Skewed Distribution  

%% 
% Create a Weibull probability distribution object. 
pd = makedist('Weibull','a',5,'b',2)  

%% 
% Compute the median of the distribution. 
m = median(pd) 

%%
% For a skewed distribution such as the Weibull distribution, the median
% and the mean may not be equal.  

%% 
% Calculate the mean of the Weibull distribution and compare it to the median. 
mean = mean(pd) 

%%
% The mean of the distribution is greater than the median.  

%% 
% Plot the pdf to visualize the distribution. 
x = [0:.1:15];
pdf = pdf(pd,x);
plot(x,pdf)