Documentation

# unifpdf

Continuous uniform probability density function

## Syntax

```Y = unifpdf(X,A,B) ```

## Description

`Y = unifpdf(X,A,B)` computes the continuous uniform pdf at each of the values in `X` using the corresponding lower endpoint (minimum), `A` and upper endpoint (maximum), `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 `B` must be greater than those in `A`.

The continuous uniform distribution pdf is

`$y=f\left(x|a,b\right)=\frac{1}{b-a}{I}_{\left[a,b\right]}\left(x\right)$`

The standard uniform distribution has A = `0` and B = `1`.

## Examples

For fixed `a` and `b`, the uniform pdf is constant.

```x = 0.1:0.1:0.6; y = unifpdf(x) y = 1 1 1 1 1 1```

What if `x` is not between `a` and `b`?

```y = unifpdf(-1,0,1) y = 0```