Main Content

betacdf

Beta cumulative distribution function

Syntax

p = betacdf(x,a,b)
p = betacdf(x,a,b,'upper')

Description

p = betacdf(x,a,b) returns the beta cdf at each of the values in x using the corresponding parameters in a and b. x, a, and b can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in a and b must all be positive, and the values in x must lie on the interval [0,1].

p = betacdf(x,a,b,'upper') returns the complement of the beta cdf at each of the values in x, using an algorithm that more accurately computes the extreme upper tail probabilities.

The beta cdf for a given value x and given pair of parameters a and b is

p=F(x|a,b)=1B(a,b)0xta1(1t)b1dt

where B( · ) is the Beta function.

Examples

collapse all

Compute the cdf for a beta distribution with parameters a = 2 and b = 2.

x = 0.1:0.2:0.9;
a = 2;
b = 2;
p = betacdf(x,a,b)
p = 1×5

    0.0280    0.2160    0.5000    0.7840    0.9720

a = [1 2 3];
p = betacdf(0.5,a,a)
p = 1×3

    0.5000    0.5000    0.5000

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a