# Why Fourier series and transform of a square wave are different?

Here is a square-wave presented by Fourier series perspective: Above coefficients shows that a square-wave is composed of only its odd harmonics.

But here below a square-wave is presented by Fourier transform perspective: Above plot shows that a square-wave is composed of all frequencies not only harmonics, plot is continuous.

When I look at the FFT of a square-wave it looks like the Fourier transform which is continuous.

Series and transform gives different interpretation of a square wave. Why is that?

• The Fourier transform of a square wave exists only as an impulse train and cannot be represented as you have shown. What you have is a Discrete Fourier Transform of a sequence of numbers that is another sequence of numbers. (That you have computed the DFT via the FFT algorithm and are calling it the FFT is irrelevant here). The sequence of numbers that is the DFT does not have the plot that you have shown: it should be a sequence of dots, similar to the Fourier series coefficients graph.That your graphics program has "connected the dots" is unfortunate. Oct 16, 2016 at 23:11
• i dont know it so well. but what is a square wave composed of then? thats the question. does a 1kHz square wave in freq. domain include a component at 999Hz or only is composed of odd harmonics of 1kHz. why are they different when we look at series and FFT? Oct 16, 2016 at 23:23
• i have no idea how you make the case that the two displayed spectra are different. Oct 17, 2016 at 1:26
• @robertbristow-johnson one is continuous the other one is discrete. if u follow continuous plot u might conclude for a 1Hz square wave signal there is 1.1Hz component which is greater than 3Hz component. which would be wrong. the continuous plot is wrong thats what u see in a scope. Oct 17, 2016 at 1:29
• you think that second plot represents the continuous Fourier Transform of a square wave??? Oct 17, 2016 at 1:32

The Fourier series expansion of a square wave is indeed the sum of sines with odd-integer multiplies of the fundamental frequency. So, responding to your comment, a 1 kHz square wave doest not include a component at 999 Hz, but only odd harmonics of 1 kHz.

The Fourier transform tells us what frequency components are present in a given signal. As the signal is periodic in this case, both the Fourier series and the Fourier transform can be calculated, and they should tell us the same information. The Fourier transform of a continuous periodic square wave is composed by impulses in every harmonic contained in the Fourier series expansion. Maybe this picture from Oppenheim's Signals and Systems may help. The actual Fourier transform are only the impulses. The dotted-line is a sinc function that doesn't apply to this question, but gives the notion that this transform has something to do with the transform of a square pulse (i.e. a not periodic signal), which happens to be a sinc.

To put it mathematically:

• The Fourier series coefficients are $$\frac{\sin(k\omega_0 T)}{k\pi}$$
• The Fourier transform is $$\sum\limits_{k=-\infty}^{\infty}\frac{2\sin(k\omega_0 T)}{k}\delta(\omega - k\omega_0)$$

So the series coefficients and the Fourier transform are the same, except that there is a proportionality factor of $2\pi$ and, in the first case, you plot bars (as the coefficients do not describe a function, they are just numbers), but in the second one you have impulses (because the Fourier transform is a function).

• i dont understand so in reality would a 1kHz square wave has no 999 Hz component? But in oscilloscope 999Hz component greater than 3kHz component. I dont get it. Oct 17, 2016 at 0:50
• No, a purely 1 kHz square wave doesn't have a 999 Hz component. Oct 17, 2016 at 0:53
• try feeding a square wave to a scope and check its FFT. you might get surprised. thats why i asked this question Oct 17, 2016 at 0:56
• Well, in reality, function generators are not ideal. They have noise and square waves are not actually square. So, if the wave you are measuring doesn't have much amplitude, then noise of the generator and the oscilloscope itself would interfere in the measurement (also, the FFT function of scopes tends to be a poor tool for precise measurements) and then, components of 3, 5 or 7 kHz could get very small in comparison. That could explain what you are getting. Oct 17, 2016 at 1:00
• @SH $T$ is the pulse width, not the period of the signal. Mar 8, 2021 at 0:15