I would expect the FFT of a periodic pulse signal to look like a sinc function, like shown [here](https://www.researchgate.net/publication/355849073/figure/fig2/AS:1085685037568003@1635858892811/Periodic-pulse-signal-a-time-domainb-frequency-domain.png). However, if I try to replicate that, what I get is a single peak at the signal frequency, and then another peak at 3 times the signal frequency. Shouldn't I see a sinc function, as a pulse contains a wide range of frequencies?

[![enter image description here](https://i.stack.imgur.com/fw46x.png)](https://i.stack.imgur.com/fw46x.png)

```
import numpy as np
from scipy.fftpack import fft
import math
import matplotlib
import matplotlib.pyplot as plt

# Parameters
M            = 64
f_sig        = 200e3
nr_of_cycles = 1e3

# Local parameters
f_s     = f_sig * M
T_s     = 1/f_s
N       = int(nr_of_cycles * M)

test_signal = np.repeat([0, 1], M // 2)
test_signal = np.tile(test_signal, int(N / M))
# test_signal = np.cos(2 * math.pi * f_sig * T_s * np.arange(N))
fft_test_signal = fft(test_signal)[0 : N//2]

fig, axs = plt.subplots(2, sharex = False, sharey = False, figsize=(8,7), num='FFT + Time')

freq = np.fft.fftfreq(N, T_s)
freq_axis = freq[0 : N//2]

axs[0].grid(which='both', axis='both')
axs[0].plot(freq_axis, abs(fft_test_signal), label='FFT Test Signal')

# axs[1].set_xscale("symlog")
axs[0].set_xlim(0, f_sig * 4)
axs[0].legend(loc='upper right', shadow=True, fontsize='x-small')
axs[0].set_ylabel('Magnitude')
axs[0].set_xlabel('Frequency [Hz]')

time_vec = np.arange(N) * T_s * 1e6
axs[1].plot(time_vec[0 : 10*M-1], test_signal[0 : 10*M-1], label='Test Signal')
axs[1].legend(loc='upper right', shadow=True, fontsize='x-small')
axs[1].set_ylabel('Amplitude')
axs[1].set_xlabel('Time [us]')

plt.show()

```