Saturday, June 2, 2018

Plot a waveform and the sum of its harmonics in Excel


I made this spreadsheet to prove that a square wave is made by the sum of a fundamental sinewave and its odd harmonics. So, to transmit a digital signal you need a bandwidth much larger than the digital clock of the transmission. Adding more harmonics improve the shape of the squarewave, but it requires more bandwidth. In the following spreadsheet you can enter amplitude and frequency of the digital signal, and the bandwidth. The spreadsheet calculates values up to 14 harmonics. All the harmonics outside the bandwidth will be ignored. Also, you can select "odd", "even" or "all" harmonics. Just to see what happens.
The amplitude of the harmonics is the entered amplitude times 2 / (π x n), where n is the number of the harmonic.


Here I have a 100 Hz signal transmitted over a 5000 Hz bandwidth. As you can see, the square wave is pretty good.

Here you can see what you would see on a spectrum analyser:



Now I reduced the bandwidth to 1000Hz, so I only have 4 odd harmonics, and the square wave is not looking as good

The spectrum shows that only 4 odd harmonics plus the fundamental are in the bandwidth:

Now I selected all the harmonics (odd+even)

No comments:

Post a Comment