1
$\begingroup$

I am really new to FFT and signal processing. I am doing an analysis of square waves with FFT and I am trying to understand why the FFT output on the frequency domain has a downward slope for square waves. Specifically:

  1. Why in FFT output for a square wave, bin 0 has the highest amplitude and bin 1 has the second highest amplitudes no matter what the original frequency of the input signal in the time series domain representation is.
  2. I read that bin 0 has to do with the ADC and that is the sum of the whole signal and that is why it is 0Hz. What does that mean?
  3. What does amplitude represent in FFT output like below?

square wave output

$\endgroup$
1

2 Answers 2

3
$\begingroup$

Simply put, a square wave can be decomposed into a weighted summation of series of sine waves, which is exactly what the Fourier transform does. Here are two animations that describe the synthesis of a square wave by accumulating sine waves.

enter image description here

enter image description here

The amplitude of FFT results are the weights of each sine waves. As seen in Fig.1, the first order harmonic has the largest weights, that's why the first bin has the highest amplitude, and the following bins have decreasing amplitudes.

An ideal square wave with an amplitude of 1 can be represented as Fourier expansion:

$$ x(t) = \mathrm{sgn}(\sin\omega t) = \frac{4}{\pi} \Big( \sin\omega t + \frac{1}{3} \sin 3\omega t + \frac{1}{5} \sin 5\omega t + \ldots \Big) $$

The above equation shows that the ideal square wave contains only components of odd harmonics and their amplitudes are decreasing. However, in real world square waves contain all integer harmonics.

Bin 0 represents DC (direct current, i.e., 0 Hz). Since your square wave has a zero mean, the DC components is zero as well. Try to add a constant value to the original square wave, then take FFT and see what happens.

$\endgroup$
2
  • $\begingroup$ For amplitude, does the first order harmonic always have the largest weight or does it depend on the input signal? All of the examples of FFT of square waves show that the first order harmonic has the most weight and I wanted to know why $\endgroup$
    – Sam
    Commented Apr 26, 2021 at 13:20
  • $\begingroup$ @Sam please see edit. $\endgroup$
    – ZR Han
    Commented Apr 27, 2021 at 1:24
1
$\begingroup$

From the title of the graph, it is seen that it is a 1Hz square wave and hence so your DFFT has a high magnitude in the initial bin (bin holding your 1Hz frequency component). Also, to be sure, perform FFT on another signal generated at a different frequency to check if that's the case.

In analog signals, it is not always mandatory that the first harmonic has high power. Several other factors contribute too.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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