I have a square wave, with 10% duty cycle. It is 90ms LOW, 10ms HIGH. Sampling frequency is 1kHz.

enter image description here

In spectral domain, after following this example, I get fundamental frequency (10Hz), as well as its harmonics. Also, the whole spectrum is enveloped with harmonics if 100Hz (which comes from pulse duration 10ms)

That is simply the case of spectral decomposition working properly for square wave, because of Fourier transform definition, right? I also read similar question but still a bit confused

  • 3
    $\begingroup$ what is your confusion about? your spectrum above looks correct to me. notice every 10th harmonic is zero. that's because you're duty cycle is 10%. normally we call it a "square wave" when the duty cycle is 50% and then every even harmonic is zero. $\endgroup$ Commented Jun 13, 2019 at 18:51

1 Answer 1


Here is one way to think about this:

  1. Start with the rectangular pulse of 10ms length. DFT is the sinc() function with a "period" of 100Hz
  2. Now repeat periodically with 100ms intervals. Mathematically that's a convolution with a 100ms pulse train.
  3. The DFT of the pulse train is also a pulse train in the frequency domain with 10 Hz spacing
  4. Convolution with in the time domain is multiplication in the frequency domain. Hence we need to multiply the 100 Hz sinc() with a 10 Hz pulse train. That's the basic shape you have: a line spectrum with 10 Hz line spacing with the overall contour of a 100Hz sinc()
  5. Sample at 1kHz. The sinc() function decays fairly slowly with frequency: around the Nyquist frequency you are only at -25 dB or so. Hence you will get non-trivial aliasing. However, since your sample rate is an integer multiple of the line spacing, the aliasing products will fall on top of the existing lines and will be hard to see. It'll just be a small deviation from the sinc() contour.

The "fuzz" between the lines appears to be noise. Your time domain wave form looks noisy and not particularly clean. It could also be caused by the way you calculate the spectrum (windowing, periodicity misalignment, FFT size, etc.)

  • $\begingroup$ i think i also have a problem with language: is it really aliasing if we sample at Fs >> Fsignal? i.e. you write itself: 1kHz sampling > 10Hz signal. I guess the right word to describe it is harmonics, right? $\endgroup$ Commented Jun 14, 2019 at 17:04
  • $\begingroup$ You need to look at the overall frequency content of the signal before you sample it. Some signals have a fundamental and harmonics, some have different structures: it's all over the place. In this case you would have to look at the highest harmonic, which doesn't really exist. Harmonics go on forever. So you need to decide how much residual aliasing you can tolerate and decide on your sample rate based on your specific requirements $\endgroup$
    – Hilmar
    Commented Jun 16, 2019 at 8:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.