# Aperiod vs Period waveform Fourier Transform: How does nature understand which is the case?

Today I reviewed the theory behind the Fourier Transform, and I asked myself a question that I couldn't answer to in the process.

Theory: A periodic waveform has a Fourier series which can be seen as the sampling of the corresponding aperiodic waveform (i.e. the series of a square wave is the sampling of the transformation of a single rectangle). So, a rectangle and a square wave have different harmonic components.

And now my question (square wave is just an example, the question is applicable to any aperiodic function): A digital driver (a clock generator if you want), drives a square wave at frequency f. It starts with a single "rectangle", its spectrum is that of the Fourier transform of a rectangle? Then it continues with many other - infinite - rectangles and you can say that it is indeed a periodic waveform (or at least it's been until that point), is its spectrum that of a square wave?

Of course, if I watch the signal with a spectrum analyzer I'll see the odd harmonics typical of a square wave... And it's absurd to say that the spectrum of the signal changes (initially that of a rectangle, and then that of a square wave). So what does really happen there?

I hope you see the incongruency that I'm trying to point out, and I would say this is not useless thinking as the spectrum of a signal says how the signal will propagate through the medium.

EDIT

From the comments it seems the question was not clear enough, let me add this:

"are you asking why you don't observe the spectrum changing in your analyzer between the 1st square wave and every subsequent square wave as it passes through?" --> My question is if this change really happens, and how it can make sense. If that really happened, it's clear why the spectrum analyzer would not show it.

EDIT 2: Clarify the meaning of rectangle and square wave

Also, when I refer to a "rectangle" or "single rectangle" I mean, basically, a single period of the square wave. To be more precise, the rising edge, high level and then falling edge are enough. Referring to it as a "square" didn't sound right to me. So I see a "square wave" as a series of "rectangles".

• Time is a wonderful healer of people and transforms. Mar 16, 2020 at 19:20
• The spectrum analyzer needs to measure the signal for a certain amount of time before the signal shows up properly. There's a tradeoff between measurement time and accuracy. Is that what you're missing? Mar 16, 2020 at 19:29
• Are you asking if the spectrum of a single square wave is the same as an infinitely long chain of square waves? Or are you asking why you don't observe the spectrum changing in your analyzer between the 1st square wave and every subsequent square wave as it passes through? Or are you asking what is the spectrum of a signal that is composed of of a rectangle followed by a square pulse? Mar 16, 2020 at 19:48
• "Or are you asking why you don't observe the spectrum changing in your analyzer between the 1st square wave and every subsequent square wave as it passes through?" --> My question if this change really happens. If that really happened, it's clear why the spectrum analyzer would not show it. Mar 16, 2020 at 20:52
• Why is it clear if it why the analyzer wouldn't show it if that's what was actually happening? Isn't it the other way around? In any case, I would expect it not to show it since the analyzer only examines looks at windows in time, unless you can "one-shot" a spectrum analyzer or record it all and play it back very slowly. I've not handled a spectrum analyzer before so I wouldn't know. Mar 16, 2020 at 21:19

The Fourier transform is a linear transform. That means the transform of a long series of pulses is identical to adding the full complex transform of each individual pulse. If you try this, carefully respecting the time offset of each pulse, and the different FT phase result that that implies, you will see something interesting. What happens is that the spectra at the harmonic frequencies will reinforce (due to the phase at that frequency of all the individual FTs being identical), and all the other frequencies will start to destructively interfere (due to non-alignment of phase of each pulses FT from all others), and thus will tend towards zero.

This is because the phases of any frequency will only all line up when adding pulses that are spaced an identical amount equal to an exact integer multiple of the period. e.g. periodic. The phases of all other frequencies will be “scrambled”. And more scrambled the more you add them together. Eventually summing to near zero (relative to the peaks).

That’s how the change happens, by constructive and destructive interference of the Fourier spectra as the pulses are added, gradually changing a single Sinc-like spectra into something approaching the spectra of a long periodic signal, which is a comb of harmonics.

Note that to do this addition, you need the full complex transform (including phase), not just a magnitude spectra. A spectrum analyzer's long FFT window does this.

Added: You can't see the change because the spectrum analyzer has already added up multiple pulses before displaying anything. (long FFT window)

• Very very interesting explanation! I've never thought about it this way. It would be interesting to see an animation of how the spectrum changes as you add more pulses. Like how you often see for the "Gibbs Phenomenon", where you add more harmonics instead. Have you ever seen something like that or I have to do it myself? Mar 18, 2020 at 21:15

It starts with a single "rectangle", its spectrum is that of the Fourier transform of a rectangle?

Yes, tautologically so.

Then it continues with many other - infinite - rectangles and you can say that it is indeed a periodic waveform (or at least it's been until that point), is its spectrum that of a square wave?

An infinitely long signal has no Fourier transform since the integral is not finite. In reality, if you can measure a signal, it is not really periodic given your finite lifespan, and so you get the Fourier transform of the aperiodic signal you measured.

The FFT is just a correlation; longer time intervals allow higher resolution; more repetitions allow higher resolution, as another answer explained.