# Rectangular function

(Redirected from Rectangle function)
Rectangular function

The rectangular function (also known as the rectangle function, rect function, Pi function, gate function, unit pulse, or the normalized boxcar function) is defined as:[1]

${\displaystyle \mathrm {rect} (t)=\Pi (t)={\begin{cases}0&{\mbox{if }}|t|>{\frac {1}{2}}\\{\frac {1}{2}}&{\mbox{if }}|t|={\frac {1}{2}}\\1&{\mbox{if }}|t|<{\frac {1}{2}}.\\\end{cases}}}$

Alternative definitions of the function define ${\displaystyle \mathrm {rect} (\pm {\tfrac {1}{2}})}$ to be 0,[2] 1,[3][4] or undefined.

## Relation to the boxcar functionEdit

The rectangular function is a special case of the more general boxcar function:

${\displaystyle \operatorname {rect} \left({\frac {t-X}{Y}}\right)=u(t-(X-Y/2))-u(t-(X+Y/2))=u(t-X+Y/2)-u(t-X-Y/2)}$

where ${\displaystyle u}$  is the Heaviside function; the function is centered at ${\displaystyle X}$  and has duration ${\displaystyle Y}$ , from ${\displaystyle X-Y/2}$  to ${\displaystyle X+Y/2}$ .

## Fourier transform of the rectangular functionEdit

The unitary Fourier transforms of the rectangular function are[1]

${\displaystyle \int _{-\infty }^{\infty }\mathrm {rect} (t)\cdot e^{-i2\pi ft}\,dt={\frac {\sin(\pi f)}{\pi f}}=\mathrm {sinc} {(f)},\,}$

using ordinary frequency f, and

${\displaystyle {\frac {1}{\sqrt {2\pi }}}\int _{-\infty }^{\infty }\mathrm {rect} (t)\cdot e^{-i\omega t}\,dt={\frac {1}{\sqrt {2\pi }}}\cdot {\frac {\mathrm {sin} \left(\omega /2\right)}{\omega /2}}={\frac {1}{\sqrt {2\pi }}}\mathrm {sinc} \left(\omega /2\right),\,}$

Plot of sinc(x) function with its frequency spectral components.

using angular frequency ω, where ${\displaystyle \mathrm {sinc} }$  is the unnormalized form of the sinc function.

Note that as long as the definition of the pulse function is only motivated by its behavior in the time-domain experience, there is no reason to believe that the oscillatory interpretation (i.e. the Fourier transform function) should be intuitive, or directly understood by humans. However, some aspects of the theoretical result may be understood intuitively, as finiteness in time domain corresponds to an infinite frequency response. (Vice versa, a finite Fourier transform will correspond to infinite time domain response.)

## Relation to the triangular functionEdit

We can define the triangular function as the convolution of two rectangular functions:

${\displaystyle \mathrm {tri} =\mathrm {rect} *\mathrm {rect} .\,}$

## Use in probabilityEdit

Viewing the rectangular function as a probability density function, it is a special case of the continuous uniform distribution with ${\displaystyle a,b=-{\frac {1}{2}},{\frac {1}{2}}}$ . The characteristic function is:

${\displaystyle \varphi (k)={\frac {\sin(k/2)}{k/2}},\,}$

and its moment generating function is:

${\displaystyle M(k)={\frac {\mathrm {sinh} (k/2)}{k/2}},\,}$

where ${\displaystyle \mathrm {sinh} (t)}$  is the hyperbolic sine function.

## Rational approximationEdit

The pulse function may also be expressed as a limit of a rational function:

${\displaystyle \Pi (t)=\lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}}$

### Demonstration of validityEdit

First, we consider the case where ${\displaystyle |t|<{\frac {1}{2}}}$ . Notice that the term ${\displaystyle (2t)^{2n}}$  is always positive for integer ${\displaystyle n}$ . However, ${\displaystyle 2t<1}$  and hence ${\displaystyle (2t)^{2n}}$  approaches zero for large ${\displaystyle n}$ .

It follows that:

${\displaystyle \lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}={\frac {1}{0+1}}=1,|t|<{\frac {1}{2}}}$

Second, we consider the case where ${\displaystyle |t|>{\frac {1}{2}}}$ . Notice that the term ${\displaystyle (2t)^{2n}}$  is always positive for integer ${\displaystyle n}$ . However, ${\displaystyle 2t>1}$  and hence ${\displaystyle (2t)^{2n}}$  grows very large for large ${\displaystyle n}$ .

It follows that:

${\displaystyle \lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}={\frac {1}{+\infty +1}}=0,|t|>{\frac {1}{2}}}$

Third, we consider the case where ${\displaystyle |t|={\frac {1}{2}}}$ . We may simply substitute in our equation:

${\displaystyle \lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}=\lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{1^{2n}+1}}={\frac {1}{1+1}}={\frac {1}{2}}}$

We see that it satisfies the definition of the pulse function.

${\displaystyle \therefore \mathrm {rect} (t)=\Pi (t)=\lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}={\begin{cases}0&{\mbox{if }}|t|>{\frac {1}{2}}\\{\frac {1}{2}}&{\mbox{if }}|t|={\frac {1}{2}}\\1&{\mbox{if }}|t|<{\frac {1}{2}}.\\\end{cases}}}$