A Rectangular Signal

Derive the DFT of a rectangular signal that appears often in DSP applications.

We'll cover the following...

A rectangular signal, also known as a rectangular window, is the signal that is most frequently encountered in DSP. This is because the fundamentals of DSP are built on the basis of continuous-time and infinite-duration signals. However, all practical signals are limited in time (say, TT seconds) that can be taken as a product between the same infinite-duration signal and a rectangular window of length TT. This process is known as windowing.

Definition

In discrete time, an odd-length rectangular sequence LL is given by:

x[n]={1,L12nL120,otherwise \begin{equation*} x[n] = \left\{ \begin{array}{l} 1, \quad -\frac{L-1}{2} \le n \le \frac{L-1}{2} \\ 0, \quad \textmd{otherwise} \\ \end{array} \right. \end{equation*}

This is drawn in the figure below for L=7L=7 and N=16N=16:

Press + to interact
A rectangular window centered at time 0
A rectangular window centered at time 0

Spectrum

The spectrum of such a signal is not really intuitive. Let’s derive and plot this spectrum with the help of the DFT.

Since the DFT is periodic over NN samples, the summation can either be from 00 to N1N-1 or N/2-N/2 to N/2N/2, even for NN. We have

X[k]=n=N2N2x[n]ej2πkNn=n=L12L12ej2πkNnX[k]=\sum_{n=-\frac{N}{2}}^{\frac{N}{2}}x[n]e^{-j2\pi\frac{k}{N}n}=\sum_{n=-\frac{L-1}{2}}^{\frac{L-1}{2}}e^{-j2\pi\frac{k}{N}n} ...