Main Content

Probability Distribution Function

Interactive density and distribution plots

Description

The Probability Distribution Function user interface creates an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution. Explore the effects of changing parameter values on the shape of the plot, either by specifying parameter values or using interactive sliders.

Required Products

  • MATLAB®

  • Statistics and Machine Learning Toolbox™

Note:disttooldoes not provide printing, code generating, or data importing functionality inMATLAB Online™.

Open the Probability Distribution Function App

  • At the command prompt, enterdisttool.

Examples

expand all

This example shows how to use the Probability Distribution Function user interface to explore the shape of cdf and pdf plots for different probability distributions and parameter values.

Open the Probability Distribution Function user interface.

disttool

The interface opens with a plot of the cdf of the Normal distribution. The initial parameter settings areMu = 0andSigma = 1.

SelectPDFfrom theFunction typedrop-down menu to plot the pdf of the Normal distribution using the same parameter values.

Change the value of the location parameterMuto 1.

As the parameter values change, the shape of the plot also changes. Also, the value ofXremains the same, but the density value changes because of the new parameter value.

Use theDistributiondrop-down menu to change the distribution type fromNormaltoWeibull.

The shape of the plot changes, along with the names and values of the parameters.

Parameters

Specify the probability distribution to explore by selecting a distribution name from the drop-down list. The drop-down list includes approximately 25 probability distribution options, includingNormal,Exponential,Poisson,Weibull, and more.

Specify the probability distribution function type as提供(cumulative distribution function) orPDF(probability density function) by selecting the function name from the drop-down list.

Specify the cumulative distribution function (cdf) value of interest as a numeric value in the range [0,1]. The corresponding random variable value appears in theXfield below the plot. Alternatively, you can specify a value forX, and theProbabilityvalue will update automatically.

This option only appears ifFunction typeis提供. IfFunction typeisPDF, then the probability density at the specifiedXvalue displays to the left of the plot.

Specify the random variable of interest as a numeric value. If theFunction typeis提供, then the corresponding cumulative distribution function (cdf) value appears in theProbabilityfield to the left of the plot. Alternatively, you can specify a value forProbability, and theXvalue will update automatically. If theFunction typeisPDF, then the corresponding probability density value appears to the left of the plot.

Specify the parameter boundaries and values as numeric values. Each column contains a field for the upper bound, value, and lower bound of one parameter. The name and number of available parameters changes based on the distribution specified in theDistributiondrop-down list. For example, if you select theNormaldistribution, thendisttoolenables two columns: One column for theMuparameter and one column for theSigmaparameter. If you select theExponentialdistribution, thendisttoolenables one column for theMuparameter.

Tips

To change the value ofX(on they-axis), orProbabilityorDensity(on thex-axis):

  • Type the values of interest into theProbabilityorXfields;

  • Click on the point of interest on the plot; or

  • Click and drag the reference lines across the plot.

See Also

Functions

Introduced before R2006a