Function whose graph is 0, then 1, then 0 again, in an almost-everywhere continuous way
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]
rect
(
t
)
=
Π
(
t
)
=
{
0
,
if
|
t
|
>
1
2
1
2
,
if
|
t
|
=
1
2
1
,
if
|
t
|
<
1
2
.
{\displaystyle \operatorname {rect} (t)=\Pi (t)=\left\{{\begin{array}{rl}0,&{\text{if }}|t|>{\frac {1}{2}}\\{\frac {1}{2}},&{\text{if }}|t|={\frac {1}{2}}\\1,&{\text{if }}|t|<{\frac {1}{2}}.\end{array}}\right.}
Alternative definitions of the function define
rect
(
±
1
2
)
{\displaystyle \operatorname {rect} \left(\pm {\frac {1}{2}}\right)}
to be 0,[ 2] 1,[ 3] [ 4] or undefined.
Relation to the boxcar function
The rectangular function is a special case of the more general boxcar function :
rect
(
t
−
X
Y
)
=
u
(
t
−
(
X
−
Y
/
2
)
)
−
u
(
t
−
(
X
+
Y
/
2
)
)
=
u
(
t
−
X
+
Y
/
2
)
−
u
(
t
−
X
−
Y
/
2
)
{\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
u
{\displaystyle u}
is the Heaviside function ; the function is centered at
X
{\displaystyle X}
and has duration
Y
{\displaystyle Y}
, from
X
−
Y
/
2
{\displaystyle X-Y/2}
to
X
+
Y
/
2
{\displaystyle X+Y/2}
.
The unitary Fourier transforms of the rectangular function are[ 1]
∫
−
∞
∞
r
e
c
t
(
t
)
⋅
e
−
i
2
π
f
t
d
t
=
sin
(
π
f
)
π
f
=
s
i
n
c
(
π
f
)
,
{\displaystyle \int _{-\infty }^{\infty }\mathrm {rect} (t)\cdot e^{-i2\pi ft}\,dt={\frac {\sin(\pi f)}{\pi f}}=\mathrm {sinc} {(\pi f)},\,}
using ordinary frequency f , and
1
2
π
∫
−
∞
∞
r
e
c
t
(
t
)
⋅
e
−
i
ω
t
d
t
=
1
2
π
⋅
s
i
n
(
ω
/
2
)
ω
/
2
=
1
2
π
s
i
n
c
(
ω
/
2
)
,
{\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
s
i
n
c
{\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 function
We can define the triangular function as the convolution of two rectangular functions:
t
r
i
=
r
e
c
t
∗
r
e
c
t
.
{\displaystyle \mathrm {tri} =\mathrm {rect} *\mathrm {rect} .\,}
Use in probability
Viewing the rectangular function as a probability density function , it is a special case of the continuous uniform distribution with
a
=
−
1
/
2
,
b
=
1
/
2
{\displaystyle a=-1/2,b=1/2}
. The characteristic function is
φ
(
k
)
=
sin
(
k
/
2
)
k
/
2
,
{\displaystyle \varphi (k)={\frac {\sin(k/2)}{k/2}},}
and its moment-generating function is
M
(
k
)
=
sinh
(
k
/
2
)
k
/
2
,
{\displaystyle M(k)={\frac {\sinh(k/2)}{k/2}},}
where
sinh
(
t
)
{\displaystyle \sinh(t)}
is the hyperbolic sine function.
Rational approximation
The pulse function may also be expressed as a limit of a rational function :
Π
(
t
)
=
lim
n
→
∞
,
n
∈
(
Z
)
1
(
2
t
)
2
n
+
1
{\displaystyle \Pi (t)=\lim _{n\rightarrow \infty ,n\in \mathbb {(} Z)}{\frac {1}{(2t)^{2n}+1}}}
Demonstration of validity
First, we consider the case where
|
t
|
<
1
2
{\displaystyle |t|<{\frac {1}{2}}}
. Notice that the term
(
2
t
)
2
n
{\displaystyle (2t)^{2n}}
is always positive for integer
n
{\displaystyle n}
. However,
2
t
<
1
{\displaystyle 2t<1}
and hence
(
2
t
)
2
n
{\displaystyle (2t)^{2n}}
approaches zero for large
n
{\displaystyle n}
.
It follows that:
lim
n
→
∞
,
n
∈
(
Z
)
1
(
2
t
)
2
n
+
1
=
1
0
+
1
=
1
,
|
t
|
<
1
2
{\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
|
t
|
>
1
2
{\displaystyle |t|>{\frac {1}{2}}}
. Notice that the term
(
2
t
)
2
n
{\displaystyle (2t)^{2n}}
is always positive for integer
n
{\displaystyle n}
. However,
2
t
>
1
{\displaystyle 2t>1}
and hence
(
2
t
)
2
n
{\displaystyle (2t)^{2n}}
grows very large for large
n
{\displaystyle n}
.
It follows that:
lim
n
→
∞
,
n
∈
(
Z
)
1
(
2
t
)
2
n
+
1
=
1
+
∞
+
1
=
0
,
|
t
|
>
1
2
{\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
|
t
|
=
1
2
{\displaystyle |t|={\frac {1}{2}}}
. We may simply substitute in our equation:
lim
n
→
∞
,
n
∈
(
Z
)
1
(
2
t
)
2
n
+
1
=
lim
n
→
∞
,
n
∈
(
Z
)
1
1
2
n
+
1
=
1
1
+
1
=
1
2
{\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.
∴
r
e
c
t
(
t
)
=
Π
(
t
)
=
lim
n
→
∞
,
n
∈
(
Z
)
1
(
2
t
)
2
n
+
1
=
{
0
if
|
t
|
>
1
2
1
2
if
|
t
|
=
1
2
1
if
|
t
|
<
1
2
.
{\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}}}
See also
References