# Triangular function

(Redirected from Triangle function)
Exemplary triangular function

A triangular function (also known as a triangle function, hat function, or tent function) is a function whose graph takes the shape of a triangle. Often this is an isosceles triangle of height 1 and base 2 in which case it is referred to as the triangular function. Triangular functions are useful in signal processing and communication systems engineering as representations of idealized signals, and the triangular function specifically as an integral transform kernel function from which more realistic signals can be derived, for example in kernel density estimation. It also has applications in pulse code modulation as a pulse shape for transmitting digital signals and as a matched filter for receiving the signals. It is also used to define the triangular window sometimes called the Bartlett window.

## Definitions

The most common definition is as a piecewise function:

${\displaystyle {\begin{array}{lcl}\operatorname {tri} (t)=\land (t)\quad &{\overset {\underset {\mathrm {def} }{}}{=}}&\max(1-|t|,0)\\&=&{\begin{cases}1-|t|&|t|<1\\0&{\mbox{otherwise}}\end{cases}}\end{array}}}$

Equivalently, it may be defined as the convolution of two identical unit rectangular functions:

${\displaystyle {\begin{array}{lcr}\operatorname {tri} (t)=\operatorname {rect} (t)*\operatorname {rect} (t)\quad &{\overset {\underset {\mathrm {def} }{}}{=}}&\int _{-\infty }^{\infty }\mathrm {rect} (\tau )\cdot \mathrm {rect} (t-\tau )\ d\tau \\&=&\int _{-\infty }^{\infty }\mathrm {rect} (\tau )\cdot \mathrm {rect} (\tau -t)\ d\tau \end{array}}}$

The triangular function can also be represented as the product of the rectangular and absolute value functions:

${\displaystyle \operatorname {tri} (t)=\operatorname {rect} (t/2)\left(1-\left|t\right|\right)}$
Triangle function (alternate)

Note that some authors instead define the triangle function to have a base of length 1 instead of length 2:

${\displaystyle {\begin{array}{lcl}\operatorname {tri} (t)=\land (t)\quad &{\overset {\underset {\mathrm {def} }{}}{=}}&\max(1-|2t|,0)\\&=&{\begin{cases}1-|2t|&|2t|<1\\0&{\mbox{otherwise}}\end{cases}}\end{array}}}$

In its most general form a triangular function is any linear B-Spline:[1]

${\displaystyle \operatorname {tri} (t)\quad ={\begin{cases}(x-t_{j})/(t_{j+1}-t_{j})&t_{j}\leq t

## Scaling

For any parameter ${\displaystyle a\neq 0}$:

{\displaystyle {\begin{aligned}\operatorname {tri} (t/a)&=\int _{-\infty }^{\infty }\mathrm {rect} (\tau )\cdot \mathrm {rect} (\tau -t/a)\ d\tau \\&={\begin{cases}1-|t/a|&|t|<|a|\\0&{\mbox{otherwise}}\end{cases}}\end{aligned}}}

## Fourier transform

The transform is easily determined using the convolution property of Fourier transforms and the Fourier transform of the rectangular function:

{\displaystyle {\begin{aligned}{\mathcal {F}}\{\operatorname {tri} (t)\}&={\mathcal {F}}\{\operatorname {rect} (t)*\operatorname {rect} (t)\}\\&={\mathcal {F}}\{\operatorname {rect} (t)\}\cdot {\mathcal {F}}\{\operatorname {rect} (t)\}\\&={\mathcal {F}}\{\operatorname {rect} (t)\}^{2}\\&=\mathrm {sinc} ^{2}(f)\end{aligned}}}

where ${\displaystyle \operatorname {sinc} (x)=\sin(\pi x)/(\pi x)}$ is the normalized sinc function.