Documentation

# expcdf

Exponential cumulative distribution function

## Syntax

```p = expcdf(x,mu) [p,plo,pup] = expcdf(x,mu,pcov,alpha) [p,plo,pup] = expcdf(___,'upper') ```

## Description

`p = expcdf(x,mu)` computes the exponential cdf at each of the values in `x` using the corresponding mean parameter `mu`. `x` and `mu` 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 input. The parameters in `mu` must be positive.

`[p,plo,pup] = expcdf(x,mu,pcov,alpha)` produces confidence bounds for `p` when the input mean parameter `mu` is an estimate. `pcov` is the variance of the estimated `mu`. `alpha` specifies 100(1 - `alpha`)% confidence bounds. The default value of `alpha` is 0.05. `plo` and `pup` are arrays of the same size as `p` containing the lower and upper confidence bounds. The bounds are based on a normal approximation for the distribution of the log of the estimate of `mu`. If you estimate `mu` from a set of data, you can get a more accurate set of bounds by applying `expfit` to the data to get a confidence interval for `mu`, and then evaluating `expinv` at the lower and upper endpoints of that interval.

`[p,plo,pup] = expcdf(___,'upper')` returns the complement of the exponential cdf at each value in `x`, using an algorithm that more accurately computes the extreme upper tail probabilities. You can use the `'upper'` argument with any of the prior syntaxes.

The exponential cdf is

`$p=F\left(x|u\right)=\underset{0}{\overset{x}{\int }}\frac{1}{\mu }{e}^{\frac{-t}{\mu }}dt=1-{e}^{\frac{-x}{\mu }}$`

The result, p, is the probability that a single observation from an exponential distribution will fall in the interval [0 x].

## Examples

collapse all

The following code shows that the median of the exponential distribution is `µ*log(2)`.

```mu = 10:10:60; p = expcdf(log(2)*mu,mu)```
```p = 1×6 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 ```

What is the probability that an exponential random variable is less than or equal to the mean, µ?

```mu = 1:6; x = mu; p = expcdf(x,mu)```
```p = 1×6 0.6321 0.6321 0.6321 0.6321 0.6321 0.6321 ```