Main Content

# TriangularDistribution

Triangular probability distribution object

## Description

A `TriangularDistribution` object consists of parameters and a model description for a triangular probability distribution.

The triangular distribution is frequently used in simulations when limited sample data is available. The lower and upper limits represent the smallest and largest values, and the location of the peak represents an estimate of the mode.

The triangular distribution uses the following parameters.

ParameterDescriptionSupport
`a`Lower limit$a\le b$
`b`Peak location$a\le b\le c$
`c`Upper limit$c\ge b$

## Creation

Create a `TriangularDistribution` probability distribution with specified parameter values object using `makedist`.

## Properties

expand all

### Distribution Parameters

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

Data Types: `single` | `double`

Location of the peak for the triangular distribution, specified as a scalar value greater than or equal to `a`.

Data Types: `single` | `double`

Upper limit for the triangular distribution, specified as a scalar value greater than or equal to `b`.

Data Types: `single` | `double`

### Distribution Characteristics

This property is read-only.

Logical flag for truncated distribution, specified as a logical value. If `IsTruncated` equals `0`, the distribution is not truncated. If `IsTruncated` equals `1`, the distribution is truncated.

Data Types: `logical`

This property is read-only.

Number of parameters for the probability distribution, specified as a positive integer value.

Data Types: `double`

This property is read-only.

Distribution parameter values, specified as a vector.

Data Types: `single` | `double`

This property is read-only.

Truncation interval for the probability distribution, specified as a vector containing the lower and upper truncation boundaries.

Data Types: `single` | `double`

### Other Object Properties

This property is read-only.

Probability distribution name, specified as a character vector.

Data Types: `char`

This property is read-only.

Distribution parameter descriptions, specified as a cell array of character vectors. Each cell contains a short description of one distribution parameter.

Data Types: `char`

This property is read-only.

Distribution parameter names, specified as a cell array of character vectors.

Data Types: `char`

## Object Functions

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

## Examples

collapse all

Create a triangular distribution object using the default parameter values.

`pd = makedist('Triangular')`
```pd = TriangularDistribution A = 0, B = 0.5, C = 1 ```

Create a triangular distribution object by specifying parameter values.

`pd = makedist('Triangular','a',-2,'b',1,'c',5)`
```pd = TriangularDistribution A = -2, B = 1, C = 5 ```

Compute the mean of the distribution.

`m = mean(pd)`
```m = 1.3333 ```

## See Also

Introduced in R2013a

Download ebook