# unifcdf

Continuous uniform cumulative distribution function

## Description

## Examples

### Calculate Uniform Distribution CDF

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 Complement of Uniform CDF

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

`x`

— Values at which to evaluate cdf

numeric scalar | numeric vector | numeric array

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`

`a`

— Lower endpoint

numeric scalar | numeric vector | numeric array

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`

`b`

— Upper endpoint

numeric scalar | numeric vector | numeric array

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

`p`

— Cdf values

nonnegative scalar | nonnegative vector | nonnegative array

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)=\frac{x-a}{b-a}{I}_{\left[a,b\right]}\left(x\right)$$

**Data Types: **`single`

| `double`

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

### GPU Arrays

Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

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)