# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# trapmf

Trapezoidal-shaped membership function

## Syntax

```y = trapmf(x,[a b c d])
```

## Description

The trapezoidal curve is a function of a vector, `x`, and depends on four scalar parameters a, b, c, and d, as given by

`$f\left(x;a,b,c,d\right)=\left\{\begin{array}{cc}0,& x\le a\\ \frac{x-a}{b-a},& a\le x\le b\\ 1,& b\le x\le c\\ \frac{d-x}{d-c},& c\le x\le d\\ 0,& d\le x\end{array}\right\}$`

or, more compactly, by

`$f\left(x;a,b,c,d\right)=\mathrm{max}\left(\mathrm{min}\left(\frac{x-a}{b-a},1,\frac{d-x}{d-c}\right),o\right)$`

The parameters a and d locate the "feet" of the trapezoid and the parameters b and c locate the "shoulders."

## Examples

collapse all

```x = 0:0.1:10; y = trapmf(x,[1 5 7 8]); plot(x,y) xlabel('trapmf, P = [1 5 7 8]') ylim([-0.05 1.05]) ```

Get trial now