# Side lobes not visible in FFT of rect function

I was making a plot to show side lobes for different spectral windows and I noticed if I take a simple fft of a rectangle window, I don't see any side lobes. I think I'm just making a simple mistake.

Here is the Python code I ran:

from matplotlib import pyplot as plt
import numpy as np
fAxis = np.linspace(-1/2,1/2,100)
rect = np.ones( 100 )
specWindow = abs(np.fft.fftshift(np.fft.fft(rect)))
plt.plot(specWindow)
plt.show()


Could anyone explain how to change my code slightly to see the side lobes I'd expect. I expect a discrete FT of a rectangle function to give me the Dirichlet kernel.

• I think the problem is that I'm after a spectral window, and that is distinct from a simple discrete Fourier transform of the time domain sequence. Dec 6 '13 at 23:46

• Indeed. Usually the signal is zero-padded to the right. Use somthing like rect_m = np.zeros(1024) rect_m[0:100] = rect. This also will give the FFT 1024 bins instead of only 100. Jan 30 '18 at 8:33