Main Content

unifcdf

Continuous uniform cumulative distribution function

Description

p = unifcdf(x,a,b) returns the continuous uniform cumulative distribution function (cdf) at each value in x using the corresponding lower endpoint a and upper endpoint b.

example

p = unifcdf(x,a,b,"upper") returns the complement of the continuous uniform cdf using an algorithm that more accurately computes the extreme upper tail probabilities.

example

Examples

collapse all

Calculate the probability that an observation from the standard uniform distribution will be less than 0.75. The standard uniform distribution corresponds to a = 0 and b = 1.

p = unifcdf(0.75)
p = 
0.7500

The probability of an observation being less than 0.75 is 0.75.

Calculate the probability that an observation from a uniform distribution with a = -1 and b = 1 will be less than 0.5.

p = unifcdf(0.5,-1,1)
p = 
0.7500

The probability of an observation being less than 0.5 is 0.75.

Calculate the probability of an observation from the standard uniform distribution being greater than 0.75.

p = unifcdf(0.75,"upper")
p = 
0.2500

The probability of an observation being greater than 0.75 is 0.25.

Input Arguments

collapse all

Values at which to evaluate the continuous uniform cdf, specified as a numeric scalar, vector, or array.

To evaluate the cdf at multiple values, specify x with an array.

If x is a vector or an array it must have the same size as a and b. If x is a scalar, the function expands x to a constant matrix that has the same dimensions as a and b.

Example: [0.5 0.75 1]

Data Types: single | double

Lower endpoint of the continuous uniform cdf, specified as a numeric scalar, vector, or array.

To evaluate the cdfs of multiple distributions specify a with an array.

If a is a vector or an array it must have the same size as x and b. If a is a scalar, the function expands a to a constant matrix that has the same dimensions as x and b.

Example: [0 -1 7 9]

Data Types: single | double

Upper endpoint of the continuous uniform cdf, specified as a numeric scalar, vector, or array.

To evaluate the cdfs of multiple distributions specify b with an array.

If b is a vector or an array it must have the same size as x and a. If b is a scalar, the function expands b to a constant matrix that has the same dimensions as x and a.

Example: [1 1 10 12]

Data Types: single | double

Output Arguments

collapse all

Cdf values evaluated at each point in x, returned as a nonnegative scalar, vector, or array with elements in the range [0,1]. The output p is the same size as x, a, and b after any necessary scalar expansion. Each element in p is the cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

The uniform cdf is

p=F(x|a,b)=xabaI[a,b](x)

Data Types: single | double

Extended Capabilities

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

Version History

Introduced before R2006a