# unifinv

Continuous uniform inverse cumulative distribution function

## Syntax

## Description

## Examples

### Calculate Inverse CDF of Continuous Uniform Distribution

Calculate the median of the standard uniform distribution.

median = unifinv(0.5)

median = 0.5000

The median (50th percentile) of the standard uniform distribution is 0.5.

Calculate the 75th and 99th percentiles of a uniform distribution with `a = -1`

and `b = 1`

.

a = -1; b = 1; P = [0.75 0.99]; X = unifinv(P,a,b)

`X = `*1×2*
0.5000 0.9800

The 75th percentile of the uniform distribution is 0.5 and the 99th percentile is 0.98.

## Input Arguments

`p`

— Probability

nonnegative scalar | nonnegative vector | nonnegative array

Probability for which `unifinv`

calculates the inverse cdf,
specified as a nonnegative scalar, vector, or array with elements in the range
[0,1].

To evaluate the inverse cdf at multiple probabilities specify
`p`

with an array.

If `p`

is a vector or an array it must have the same size as
`a`

and `b`

. If `p`

is a
scalar, the function expands `p`

to a constant matrix that has the
same dimensions as `a`

and `b`

.

**Example: **`[0.1 0.5 0.75 0.99]`

**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 inverse cdf of multiple distributions, specify
`a`

with an array.

If `a`

is a vector or an array it must have the same size as
`p`

and `b`

. If `a`

is a
scalar, the function expands `a`

to a constant matrix that has the
same dimensions as `p`

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 inverse cdf of multiple distributions, specify
`b`

with an array.

If `b`

is a vector or an array it must have the same size as
`p`

and `a`

. If `b`

is a
scalar, the function expands `b`

to a constant matrix that has the
same dimensions as `p`

and `a`

.

**Example: **`[1 1 10 12]`

**Data Types: **`single`

| `double`

## Output Arguments

`x`

— Inverse of uniform cdf

numeric scalar | numeric vector | numeric array

Inverse of the uniform cdf, specified as a numeric scalar, vector, or array.

Each element in `x`

is
the inverse cdf value of the distribution specified by the corresponding elements in
`a`

and `b`

, evaluated at the corresponding
probabilities in `p`

.

The inverse of the uniform cdf is

$$x={F}^{-1}\left(p|a,b\right)=a+p\left(a-b\right){I}_{\left[0,1\right]}\left(p\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)