betapdf
Beta probability density function
Syntax
Description
Examples
Compute the pdf values evaluated at the values in x
for the beta distribution with first shape parameter a
and second shape parameter b
.
x = 0.2:0.2:1; a = 2; b = 1; y = betapdf(x,a,b)
y = 1×5
0.4000 0.8000 1.2000 1.6000 2.0000
Compute the pdf values evaluated at 0.1
for various beta distributions with different first shape parameter values.
a = [1,2,3]; b = 1; y = betapdf(0.1,a,b)
y = 1×3
1.0000 0.2000 0.0300
Input Arguments
Values at which to evaluate the pdf, specified as a scalar value or an array of scalar values in the range [0,1].
To evaluate the pdf at multiple values, specify
x
using an array. To evaluate the pdfs of multiple distributions,
specify a
and b
using arrays. If one or more
of the input arguments x
, a
, and
b
are arrays, then the array sizes must be the same. In this
case, betapdf
expands each scalar input into a constant array
of the same size as the array inputs. Each
element in y
is the pdf value of the distribution specified by
the corresponding elements in a
and b
,
evaluated at the corresponding element in x
.
Example: [-1,0,3,4]
Data Types: single
| double
First shape parameter, specified as a positive scalar value or a numeric array of positive values.
To evaluate the pdf at multiple values, specify
x
using an array. To evaluate the pdfs of multiple distributions,
specify a
and b
using arrays. If one or more
of the input arguments x
, a
, and
b
are arrays, then the array sizes must be the same. In this
case, betapdf
expands each scalar input into a constant array
of the same size as the array inputs. Each
element in y
is the pdf value of the distribution specified by
the corresponding elements in a
and b
,
evaluated at the corresponding element in x
.
Example: [0.75,0.5;10,100]
Data Types: single
| double
Second shape parameter, specified as a positive scalar value or a numeric array of positive values.
To evaluate the pdf at multiple values, specify
x
using an array. To evaluate the pdfs of multiple distributions,
specify a
and b
using arrays. If one or more
of the input arguments x
, a
, and
b
are arrays, then the array sizes must be the same. In this
case, betapdf
expands each scalar input into a constant array
of the same size as the array inputs. Each
element in y
is the pdf value of the distribution specified by
the corresponding elements in a
and b
,
evaluated at the corresponding element in x
.
Example: [0.2,100;4,7]
Data Types: single
| double
Output Arguments
pdf values, evaluated at the values in x
, returned as a scalar
value or an array of scalar values. y
is the same size as
x
, a
, and b
after any
necessary scalar expansion. Each element in
y
is the pdf value of the distribution specified by the
corresponding elements in a
and b
, evaluated
at the corresponding element in x
.
More About
The beta probability density function for a given value x and given pair of parameters a and b is
where B( · ) is the Beta function. The uniform distribution on (0 1) is a degenerate case of the beta pdf where a = 1 and b = 1.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)