# prob.UniformDistribution class

Package: prob
Superclasses: prob.ParametricTruncatableDistribution

Uniform probability distribution object

## Description

`prob.UniformDistribution` is an object consisting of parameters and a model description for a uniform probability distribution. Create a probability distribution object with specified parameters using `makedist`.

## Construction

`pd = makedist('Uniform')` creates a uniform probability distribution object using the default parameter values.

`pd = makedist('Uniform','Lower',lower,'Upper',upper)` creates a uniform distribution object using the specified parameter values.

collapse all

### `lower` — Lower parameter`0` (default) | scalar value

Lower limit for the uniform distribution, specified as a scalar value.

Data Types: `single` | `double`

### `upper` — Upper parameter`1` (default) | scalar value

Upper parameter for the uniform distribution, specified as a scalar value greater than `lower`.

Data Types: `single` | `double`

## Properties

collapse all

### `lower` — Lower parameterscalar value

Lower parameter for the uniform distribution, stored as a scalar value.

Data Types: `single` | `double`

### `upper` — Upper parameterscalar value

Upper parameter for the uniform distribution, stored as a scalar value greater than `lower`.

Data Types: `single` | `double`

### `DistributionName` — Probability distribution nameprobability distribution name string

Probability distribution name, stored as a valid probability distribution name string. This property is read-only.

Data Types: `char`

### `IsTruncated` — Logical flag for truncated distribution`0` | `1`

Logical flag for truncated distribution, stored as a logical value. If `IsTruncated` equals `0`, the distribution is not truncated. If `IsTruncated` equals `1`, the distribution is truncated. This property is read-only.

Data Types: `logical`

### `NumParameters` — Number of parameterspositive integer value

Number of parameters for the probability distribution, stored as a positive integer value. This property is read-only.

Data Types: `single` | `double`

### `ParameterDescription` — Distribution parameter descriptionscell array of strings

Distribution parameter descriptions, stored as a cell array of strings. Each cell contains a short description of one distribution parameter. This property is read-only.

Data Types: `char`

### `ParameterNames` — Distribution parameter namescell array of strings

Distribution parameter names, stored as a cell array of strings. This property is read-only.

Data Types: `char`

### `ParameterValues` — Distribution parameter valuesvector of scalar values

Distribution parameter values, stored as a vector. This property is read-only.

Data Types: `single` | `double`

### `Truncation` — Truncation intervalvector of scalar values

Truncation interval for the probability distribution, stored as a vector containing the lower and upper truncation boundaries. This property is read-only.

Data Types: `single` | `double`

## Methods

### Inherited Methods

 cdf Cumulative distribution function of probability distribution object icdf Inverse cumulative distribution function of probability distribution object iqr Interquartile range of probability distribution object median Median of probability distribution object pdf Probability density function of probability distribution object random Generate random numbers from probability distribution object truncate Truncate probability distribution object
 mean Mean of probability distribution object std Standard deviation of probability distribution object var Variance of probability distribution object

## Definitions

### Uniform Distribution

The uniform distribution has a constant probability density function between its two parameters, lower (the minimum) and upper (the maximum). This distribution is appropriate for representing round-off errors in values tabulated to a particular number of decimal places.

The uniform distribution uses the following parameters.

ParameterDescriptionSupport
`lower`Lower parameter$-\infty
`upper`Upper parameter$lower

The probability density function (pdf) is

$f\left(x|lower,upper\right)=\left\{\begin{array}{c}\left(\frac{1}{upper-lower}\right)\text{ };\text{ }lower\le x\le upper\\ \text{ }\text{ }\text{ }\text{\hspace{0.17em}}0\text{ };\text{ }otherwise\end{array}\text{ }.$

and 0 otherwise.

## Examples

collapse all

### Create a Uniform Distribution Object Using Default Parameters

Create a uniform distribution object using the default parameter values.

`pd = makedist('Uniform')`
```pd = UniformDistribution Uniform distribution Lower = 0 Upper = 1```

### Create a Uniform Distribution Object Using Specified Parameters

Create a uniform distribution object by specifying parameter values.

`pd = makedist('Uniform','Lower',-4,'Upper',2)`
```pd = UniformDistribution Uniform distribution Lower = -4 Upper = 2```

Compute the interquartile range of the distribution

`r = iqr(pd)`
```r = 3```