Documentation Center

  • Trial Software
  • Product Updates


Class: prob.TruncatableDistribution
Package: prob

Median of probability distribution object


m = median(pd)


m = median(pd) returns the median m for the probability distribution pd.

Input Arguments

expand all

pd — Probability distributionprobability distribution object

Probability distribution, specified as a probability distribution object. Create a probability distribution object with specified parameter values using makedist. Alternatively, for fittable distributions, create a probability distribution object by fitting it to data using fitdist or the Distribution Fitting app.

Output Arguments

expand all

m — Medianscalar value



expand all

Median of a Fitted Distribution


load examgrades;
x = grades(:,1);

Create a normal distribution object by fitting it to the data.

pd = fitdist(x,'Normal')
pd = 


  Normal distribution
       mu = 75.0083   [73.4321, 76.5846]
    sigma =  8.7202   [7.7391, 9.98843]

Compute the median of the fitted distribution.

m = median(pd)
m =


For a symmetrical distribution such as the normal distribution, the median will be equal to the mean, mu.

Median of a Skewed Distribution

Create a Weibull probability distribution object.

pd = 


  Weibull distribution
    A = 5
    B = 2

Compute the median of the distribution.

m = median(pd)
m =



mean = mean(pd)
mean =

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);

See Also

| | | |

Was this topic helpful?