Rectangular function

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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

File:Rectangular function.svg
Rectangular function with <math display="inline">T = 1</math>

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">Template:MathWorld</ref>

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

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

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

Alternative definitions of the function define <math display="inline">\operatorname{rect}\left(t=\pm\frac{T}{2}\right)</math> to be 0,<ref>Template:Cite book</ref> 1,<ref>Template:Cite book</ref><ref>Template:Cite book</ref> or undefined. The area under the curve does not change for the different definitions of the functions at <math display="inline">t=\pm\frac{T}{2}</math>.

The rectangular function can be used as the basis for a rectangular wave.

History

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 function

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 function

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>

Self convolution of the Rectangular function

File:Splines resulting from successive convolution of the unit Rect function.png
The unit Rectangular function (in which <math display="inline">T=1</math>) along with the piecewise defined splines that result from successive convolutions of the Rectangular function with itself.

The self convolution of the dis-continuous rectangular function results in the triangular function, a piecewise defined spline that is continuous, but not continuously differentiable. Successive convolutions of the rectangular function result in piecewise defined pulses with lower maximums which are wider and smoother, with "smoother" meaning higher-order derivatives are coninuous.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

A convolution of the discontinuous rectangular function with itself results in the triangular function, which is a continuous function:

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

  \begin{cases}
     1 + t, &  -T < t < 0 \\
     1 - t, &   \,\,\,\,\, 0 < t < T \\
     0      & \,\,\,\,\,\text{otherwise} \\
     \end{cases}

\end{align} </math>

Self convolution of the rectangular function applied twice yields a continuous and differentiably continuous parabolic spline:

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

  \begin{cases}
     \frac{9}{8} + \frac{3}{2}t + \frac{1}{2}t^2, &  -\frac{3}{2}T < t < -\frac{1}{2}T \\
     \frac{3}{4} - t^2,  &   -\frac{1}{2}T < t < \frac{1}{2}T \\
     \frac{9}{8} - \frac{3}{2}t + \frac{1}{2}t^2, &  \,\,\,\,\, \frac{1}{2}T < t < \frac{3}{2}T \\
     0      & \,\,\,\,\,\text{otherwise} \\
     \end{cases}

\end{align} </math>

A self convolution of the rectangular function applied three times yields a continuous, and a second order differentiably continuous cubic spline:

<math display=block> \begin{align} \operatorname{tri(t/T)} * \operatorname{tri(t/T)} =

  \begin{cases}
     \frac{4}{3} + {2}t + t^2 +\frac{1}{6}t^3 , & -2T  < t < -T \\
     \frac{2}{3} - t^2 - \frac{1}{2}t^3,  &   -T < t < 0 \\
     \frac{2}{3} - t^2 + \frac{1}{2}t^3,  &   \,\,\,\,\,0 < t < T \\
     \frac{4}{3} - {2}t + t^2 -\frac{1}{6}t^3 , & \,\,\,\,\,T  < t < 2T \\
     0      & \,\,\,\,\,\text{otherwise} \\
     \end{cases}

\end{align} </math>

A self convolution of the rectangular function applied four times yields a continuous, and a third order differentiably continuous 4th order spline:

<math display=block> \begin{align} 4^{th}\,\text{order spline} =

  \begin{cases}
     \frac{625}{384} + \frac{125}{48}t + \frac{25}{16}t^2 +\frac{5}{12}t^3 + \frac{1}{24}t^4, & -\frac{5}{2}T  < t < -\frac{3}{2}T \\
     \frac{55}{96} - \frac{5}{24}t - \frac{5}{4} t^2 - \frac{5}{6}t^3 -\frac{1}{6}t^4,  &   -\frac{3}{2}T < t < -\frac{1}{2}T \\
     \frac{115}{192} - \frac{5}{8}t^2 + \frac{1}{4}t^4,  &   -\frac{1}{2}T < t < \frac{1}{2}T \\
     \frac{55}{96} + \frac{5}{24}t - \frac{5}{4} t^2 + \frac{5}{6}t^3 -\frac{1}{6}t^4,  &   \,\,\,\,\,\frac{1}{2}T < t < \frac{3}{2}T \\
     \frac{625}{384} - \frac{125}{48}t + \frac{25}{16}t^2 -\frac{5}{12}t^3 + \frac{1}{24}t^4, & \,\,\,\,\,\frac{3}{2}T  < t < \frac{5}{2}T \\
     0      & \,\,\,\,\,\text{otherwise} \\
     \end{cases}

\end{align} </math>


Since the Fourier Transform of the Rectangular function is the Sinc function, the Convolution theorem mean that the Fourier transform of pulses resulting from successive convolution of the Rectangular function with itself is simply the Sinc function to the order of the number of times that the convolution function was applied + 1 (i.e., the Fourier transform of the Triangular function is Sinc2, the Fourier transform of parabolic spline resulting from two successive convolutions of the Rectangular function with itself is Sinc3, etc.)

Use in probability

{{#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 approximation

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 validity

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 function

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 also

References

Template:Reflist