This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Probability density function of the beta distribution

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


stats::betaPDF(a, b)


stats::betaPDF(a, b) returns a procedure representing the probability density function


of the beta distribution with shape parameters a > 0 and b > 0

The procedure f := stats::betaPDF(a, b) can be called in the form f(x) with an arithmetical expression x. The return value of f(x) is either a floating-point number or a symbolic expression:

  • If x is a real floating-point number and a and b can be converted to positive floating-point numbers, then f(x) returns a floating-point number.

  • If 0 < x < 1 can be decided, the expression x^(a-1)*(1-x)^(b-1)/beta(a, b) is returned. If x ≤ 0 or x ≥ 1 can be decided, then 0, respectively 0.0, is returned.

  • The calls f(- infinity ) and f( infinity ) return 0.

  • In all other cases, f(x) returns the symbolic call stats::betaPDF(a, b)(x).

Numerical values of a and b are only accepted if they are positive.

Environment Interactions

The function is sensitive to the environment variable DIGITS which determines the numerical working precision. The procedure returned by stats::betaPDF reacts to properties of its argument.


Example 1

We evaluate the probability density function with a = 3 and b = 4 at various points:

f := stats::betaPDF(3, 4):
f(-infinity), f(-1), f(1/2), f(0.7), f(infinity)

delete f:

Example 2

If x is a symbolic object without properties, then it cannot be decided whether 0 < x < 1 holds. A symbolic function call is returned:

f := stats::betaPDF(a, b): f(x)

With suitable properties, an explicit expression is returned:

assume(0 < x < 1): f(x)

assume(x > 1): f(x)

unassume(x): delete f:


a, b

The shape parameters of the beta distribution: arithmetical expressions representing positive real values.

Return Values


Was this topic helpful?