# If a square wave is a sum of odd harmonic impulses, why is it continuous in the frequency domain?

A square wave is a sum of sinusoids so surely it should be represented as individual discrete impulses in the frequency domain, where all other frequencies are 0. Why instead are those intermediate frequency components not 0, and form a continuous sinc shape? I know that the continuous fourier transform of $$A\text{rect}(\frac{t}{\tau}) = A\tau \text{sinc}(f\pi\tau)$$, but why is this the case when you think about it in the first perspective?

• Discrete vs continuous? They are not interchangeable. Jul 20 '20 at 12:20
• Clarify what you mean by continuous? Do you mean continuous vs discrete or continuous as in the smoothness of the derivatives? Jul 20 '20 at 12:44

As @Hilmar mentioned I think you get confused between Square wave and Rectangular function.

A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same duration at minimum and maximum.

Which its Fourier Transform is only at harmonic frequencies and its value is equal to Fourier series coefficient.

The rectangular functionis defined as:

which look like this:

and its Fourier Transform is a sinc function that looks like this:

• Oh yes of course Jul 20 '20 at 20:17
• But the impulses are in the shape of a sinc nonetheless. I found this similar question: dsp.stackexchange.com/questions/34844/… Jul 20 '20 at 20:24
• @m-sh-shokouhi The Fourier Transform of a periodic square wave is not a stream of impulses as you show in the second figure.Those impulses would be weighted by the Sinc function, resulting in odd harmonics for a 50% duty cycle square wave since the even harmonics will fall in the nulls of the Sinc. Jul 21 '20 at 2:08
• @DanBoschen I agree with you. I will correct it. Jul 21 '20 at 2:11

Depends on what you mean by "square wave".

A single rectangular pulse has indeed a sinc spectrum

An infinitely repeating series of rectangular pulses has a line spectrum with discrete frequencies

A square wave is not a Sinc function in the frequency domain, but a sampled Sinc function (Even as a continuous function, the non-zero values are samples of the Sinc function in frequency). An individual rectangular pulse is a continuous Sinc function. The difference is the former is repeating in time. Repetition in one domain relates to sampling in the other domain.

This property holds for any repeating pattern. The envelope will be the Fourier Transform of the base shape, and then when repeating, non-zero frequency values will only exist at integer multiples of the repetition rate. This is demonstrated with two variants of a repeating pulse below, the first with a 50% duty cycle and the second with a 25% duty cycle. The pulse has a Fourier Transform as a Sinc function with the first nulls at $$1/T$$ where T is the pulse width (in this case 0.05 seconds and 0.025 seconds), while the pulse is repeating at a 10 Hz rate in both cases. The red trace is the Fourier Transform of the pulse (a Sinc) while the impulses shown are the non-zero frequency components.

• @LewisKelsey When you repeat anything it MUST be discrete in frequency; a continuous frequency spectrum can’t exist (unless you allow zero values). This is clear by studying the Fourier Series Expansion where it is clear that you can’t possibly reconstruct the signal, and have it repeat, unless every harmonic similarly repeats over that cycle. So this propery can be carried to any fundamental shape — the transform will have the envelope of that shape but the frequencies can only exist (as non-zero values) at harmonics of the repetition rate Jul 22 '20 at 23:47
• @Lewis Also not sure if this helps you or not but you can completely swap the domains which sometimes provides more intuition. For example, if you are familiar with sampling in time (A/D and D/A conversion) and how that creates periodicity in frequency: it's the same exact relationship so more generally Sampling in one domain is Periodicity in the other domain. Jul 23 '20 at 12:06
• Yes in this case if the time domain waveform is symmetric about 0 (non causal) the phase will only be 0 and 180 in frequency (frequency will only be real) but in general cases it would be complex in which case we would plot magnitude (all positive) and phase separately. If you haven’t already I think it would be instructive for you to work out the Fourier Series Expansion of sich a repeating pulse (start with a square wave to see how you only get the odd harmonics). Do the reconstruction from the harmonica back to time manually to see how the square wave gets reconstructed— Jul 25 '20 at 13:28
• Then try any other frequency in the reconstruction to see how that possibly can’t work and it should all be clearer. Also keep in mind that the Fourier Series Expansion of a waveform over finite time 0 to T (or -T/2 to +T/2) is identical to the infinite duration waveform with that original waveform periodically repeating in time. Doing this exercise I suggest will make that clearer too Jul 25 '20 at 13:30
• If you want to know why this is true work through the math but a GREAT example is Euler's formula for sine and cosine (both real functions!). What are they in the frequency domain? Symmetric/assymetric real/complex? Jul 26 '20 at 23:28