Rectangular function

Revision as of 21:11, 28 May 2025 by imported>Natsuhata (→‎Fourier transform of the rectangular function)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:Redirect Template:Use American English

File:Rectangular function.svg
Rectangular function with a = 1

The rectangular function (also known as the rectangle function, rect function, Pi function, Heaviside Pi function,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> gate function, unit pulse, or the normalized boxcar function) is defined as<ref name="wolfram">{{#invoke:Template wrapper|{{#if:|list|wrap}}|_template=cite web |_exclude=urlname, _debug, id |url = https://mathworld.wolfram.com/{{#if:RectangleFunction%7CRectangleFunction.html}} |title = Rectangle Function |author = Weisstein, Eric W. |website = MathWorld |access-date = |ref = Template:SfnRef }}</ref>

<math display="block">\operatorname{rect}\left(\frac{t}{a}\right) = \Pi\left(\frac{t}{a}\right) = \left\{\begin{array}{rl}

0, & \text{if } |t| > \frac{a}{2} \\
\frac{1}{2}, & \text{if } |t| = \frac{a}{2} \\
1, & \text{if } |t| < \frac{a}{2}.

\end{array}\right.</math>

Alternative definitions of the function define <math display="inline">\operatorname{rect}\left(\pm\frac{1}{2}\right)</math> to be 0,<ref>Template:Cite book</ref> 1,<ref>Template:Cite book</ref><ref>Template:Cite book</ref> or undefined.

Its periodic version is called a rectangular wave.

HistoryEdit

The rect function has been introduced 1953 by Woodward<ref>Template:Cite journal</ref> in "Probability and Information Theory, with Applications to Radar"<ref>Template:Cite book</ref> as an ideal cutout operator, together with the sinc function<ref>Template:Cite book</ref><ref>Template:Cite book</ref> as an ideal interpolation operator, and their counter operations which are sampling (comb operator) and replicating (rep operator), respectively.

Relation to the boxcar functionEdit

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

<math display=block>\operatorname{rect}\left(\frac{t-X}{Y} \right) = H(t - (X - Y/2)) - H(t - (X + Y/2)) = H(t - X + Y/2) - H(t - X - Y/2)</math>

where <math>H(x)</math> is the Heaviside step function; the function is centered at <math>X</math> and has duration <math>Y</math>, from <math>X-Y/2</math> to <math>X+Y/2.</math>

Fourier transform of the rectangular functionEdit

File:Sinc function (normalized).svg
Plot of normalized <math>\operatorname{sinc}(x)</math> function (i.e. <math>\operatorname{sinc}(\pi x)</math>) with its spectral frequency components.

The unitary Fourier transforms of the rectangular function are<ref name="wolfram"/> <math display="block">\int_{-\infty}^\infty \operatorname{rect}(t)\cdot e^{-i 2\pi f t} \, dt =\frac{\sin(\pi f)}{\pi f} = \operatorname{sinc}(\pi f) =\operatorname{sinc}_\pi(f),</math> using ordinary frequency Template:Mvar, where <math>\operatorname{sinc}_\pi</math> is the normalized form<ref>Wolfram MathWorld, https://mathworld.wolfram.com/SincFunction.html</ref> of the sinc function and <math display="block">\frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty \operatorname{rect}(t)\cdot e^{-i \omega t} \, dt =\frac{1}{\sqrt{2\pi}}\cdot \frac{\sin\left(\omega/2 \right)}{\omega/2} =\frac{1}{\sqrt{2\pi}} \cdot \operatorname{sinc}\left(\omega/2 \right), </math> using angular frequency <math>\omega</math>, where <math>\operatorname{sinc}</math> is the unnormalized form of the sinc function.

For <math>\operatorname{rect} (x/a)</math>, its Fourier transform is<math display="block">\int_{-\infty}^\infty \operatorname{rect}\left(\frac{t}{a}\right)\cdot e^{-i 2\pi f t} \, dt =a \frac{\sin(\pi af)}{\pi af} = a\ \operatorname{sinc}_\pi{(a f)}.</math>

Relation to the triangular functionEdit

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

<math display=block>\operatorname{tri(t/T)} = \operatorname{rect(2t/T)} * \operatorname{rect(2t/T)}.\,</math>

Use in probabilityEdit

{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}} Viewing the rectangular function as a probability density function, it is a special case of the continuous uniform distribution with <math>a = -1/2, b = 1/2.</math> The characteristic function is

<math display=block>\varphi(k) = \frac{\sin(k/2)}{k/2},</math>

and its moment-generating function is

<math display=block>M(k) = \frac{\sinh(k/2)}{k/2},</math>

where <math>\sinh(t)</math> is the hyperbolic sine function.

Rational approximationEdit

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

<math display="block">\Pi(t) = \lim_{n\rightarrow \infty, n\in \mathbb(Z)} \frac{1}{(2t)^{2n}+1}.</math>

Demonstration of validityEdit

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

It follows that: <math display="block">\lim_{n\rightarrow \infty, n\in \mathbb(Z)} \frac{1}{(2t)^{2n}+1} = \frac{1}{0+1} = 1, |t|<\tfrac{1}{2}.</math>

Second, we consider the case where <math display="inline">|t|>\frac{1}{2}.</math> Notice that the term <math display="inline">(2t)^{2n}</math> is always positive for integer <math>n.</math> However, <math>2t>1</math> and hence <math display="inline">(2t)^{2n}</math> grows very large for large <math>n.</math>

It follows that: <math display="block">\lim_{n\rightarrow \infty, n\in \mathbb(Z)} \frac{1}{(2t)^{2n}+1} = \frac{1}{+\infty+1} = 0, |t|>\tfrac{1}{2}.</math>

Third, we consider the case where <math display="inline">|t| = \frac{1}{2}.</math> We may simply substitute in our equation:

<math display="block">\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} = \tfrac{1}{2}.</math>

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

<math display="block">\operatorname{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}</math>

Dirac delta functionEdit

The rectangle function can be used to represent the Dirac delta function <math>\delta (x)</math>.<ref name=":0">Template:Cite book</ref> Specifically,<math display="block">\delta (x) = \lim_{a \to 0} \frac{1}{a}\operatorname{rect}\left(\frac{x}{a}\right).</math>For a function <math>g(x)</math>, its average over the width <math>a</math> around 0 in the function domain is calculated as,

<math display="block">g_{avg}(0) = \frac{1}{a} \int\limits_{- \infty}^{\infty} dx\ g(x) \operatorname{rect}\left(\frac{x}{a}\right).</math> To obtain <math>g(0)</math>, the following limit is applied,

<math display="block">g(0) = \lim_{a \to 0} \frac{1}{a} \int\limits_{- \infty}^{\infty} dx\ g(x) \operatorname{rect}\left(\frac{x}{a}\right)</math> and this can be written in terms of the Dirac delta function as, <math display="block">g(0) = \int\limits_{- \infty}^{\infty} dx\ g(x) \delta (x).</math>The Fourier transform of the Dirac delta function <math>\delta (t)</math> is

<math display="block">\delta (f) = \int_{-\infty}^\infty \delta (t) \cdot e^{-i 2\pi f t} \, dt = \lim_{a \to 0} \frac{1}{a} \int_{-\infty}^\infty \operatorname{rect}\left(\frac{t}{a}\right)\cdot e^{-i 2\pi f t} \, dt = \lim_{a \to 0} \operatorname{sinc}{(a f)}.</math> where the sinc function here is the normalized sinc function. Because the first zero of the sinc function is at <math>f = 1 / a</math> and <math>a</math> goes to infinity, the Fourier transform of <math>\delta (t)</math> is

<math display="block">\delta (f) = 1,</math> means that the frequency spectrum of the Dirac delta function is infinitely broad. As a pulse is shorten in time, it is larger in spectrum.

See alsoEdit

ReferencesEdit

Template:Reflist