# approximation of a digital signal using the harmonic

I'm new to EE, still struggling in understanding some basic concepts. I'm reading a book which says about approximation:

To make the shape of the analog signal look more like that of a digital signal, we need to add more harmonics of the frequencies. We need to increase the bandwidth. We can increase the bandwidth to 3N/2, 5N/2, 7N/2, and so on. The picture belows shows the effect of this increase for one of the worst cases, the pattern 010. We use the first, third, and fifth harmonics. The required bandwidth is now 5N/2, the difference between the lowest frequency 0 and the highest frequency 5N/2. I'm confused, below is my questions:

Q1-why we have to third, and fifth harmonics? Can't we use second, fourth harmonics? does it have to be odd harmonics?

Q2-I'm from CS background, can I put the approximation in this way:

To simulate the pattern 010 in a channel whose bandwidth is 3N/2(to get more precise result than N/2), does it mean we need to send two analog signals simultaneously, the first analog signal's frequency to be N/2, the second signal's frequency to be 3N/2, and let they interfere with each other, and the result would be an better approximation of a digital signal 010?

Is my understanding correct

• It's all about Fourier transform. You should use mathematical books. Oct 7, 2019 at 6:25
• @MarkoBuršič, Fourier series, really.
– Chu
Oct 7, 2019 at 6:49
• square waves have no even harmonics., like 01010101... = N bit rate but f=N/2 square wave yet 001001001001 has same bit rate but now spectrum N/3 and also some spectrum at f=N/2 ...then random serial data fills the gap, BUT phase shift of upper harmonics can distort zero-cross and add jitter so harmonic limiting must be done with care or special maximal FLAT group delay filters or raised cosine Oct 7, 2019 at 6:49
• Hello OP, welcome to eesx. Nice first question, and don't worry, we've all struggled just like you. Do you have any hint about what "...look more like..." means? If you take the image with f=N/2, and sample it smartly, you recover your digital signal perfectly. I suspect that the book is introducing the Fourier series; have a look at that page (you don't need all the math just yet) and see if it helps you. Oct 7, 2019 at 7:28
• @VladimirCravero I will definitely read Fourier series later, could you answer my questions Q1 and Q2 first, I just need conclusions, because it is blocking me from understanding sth else, once I have the conclusion, I will spend sometime on Fourier Series. Oct 7, 2019 at 7:35

I will answer your questions just as they are asked - keep in mind that a thorough understanding of the topic requires careful study of the Fourier series.

A1: You use only odd harmonics because a square wave contains only odd harmonics. Again, the Fourier series explains it quantitatively, but for a qualitative understanding try to see it like this: if you look at the original square wave, you will see that the signal is very fast when t=0, t=T/2, t=T and so on. When t = kT it is rising fast, when t = kT/2 it is falling fast. This same property is shared with odd harmonics, while even harmonics it is the opposite.

A2: Your approximation is on the right path, but some things are not extremely precise. If you want to synthesise a square wave, you do not combine multiple sine waves "in the real world". Seeing a square wave as a sum of sinusoids is useful so that you can estimate the BW you will need to transmit it, for example, or you can understand if some imperfection that you are measuring are there because of the limited bandwidth of the instrument, or maybe come from somewhere else.

Digital signals "do not exist", the world we live in is analog. A digital signal is a mathematical artefact that is useful for a certain type of analysis, so you will never try to approximate a digital signal in the real world. What you can say is that you want to approximate a square wave, and the more harmonics you use, the better your approximation is.

• when you said "the more harmonics you use, the better your approximation is", do you mean send multiple signals in different frequencies (corresponds to different harmonics), and let they interfere each other, the final result is the approximation of the square wave? Oct 7, 2019 at 8:33
• It is not what I mean, the approximation I refer to is purely mathematical. In the real world, it works exactly in the same way so if you take multiple generators and sum them (you refer to this with interfere), then yes, you get a better square wave the more generators you use. It is just something that is not done in the real world, not for a square wave at least. Oct 7, 2019 at 8:54
• so how it get done in real world if I want to do an approximation of square wave? Oct 7, 2019 at 9:03
• In the real world generating something very close to a square wave is simpler than generating a bunch of sine waves; you just use a couple of transistors (they are like switches), and you turn them on or off; to generate a sine wave you need to partially turn on the transistors, because you need all the voltages between 0 and 1, therefore it is more complicated. So to answer your question, if you want that you just use a circuit that does exactly that, without the need of any sine wave. Oct 7, 2019 at 11:31

Q1. The textbook is not explaining it well. Consider a Fourier Transform of a signal. If the signal is a 50% duty cycle square wave (as b. Square below) then it will only have odd harmonics. There is no frequency content at even harmonics. However if the square wave was to have any other duty cycle other than 50% (as in a. Pulse below) then there would be odd and even harmonic content.

Q2. Look at the second picture I post "Harmonics vs Output". As you sum together more harmonics, you approach closer to a true square waveform. Yes you could send multiple harmonics and have them sum together, but this is never actually done in practice.

Let's say we have a 1kHz square wave we want to reproduce. Let's say we have a system that will take Fourier Transforms with different bandwidths. If we only took the first harmonic, we would get blue output corresponding to k=1. This output is bad with lots of overshoot and undershoot. Now let's say we take the Fourier Transform with content up to 11kHz, well now our output looks like the blue waveform corresponding to k=11. It's much better with some ripple and much less over/undershoot. Now if I told you what the max ripple was and my max undershoot and overshoot for a design problem, you could work backwards to figure out how much bandwidth your system needs to have to meet the specifications I give. From this you could then figure out the sample rate needed, if you are performing a Discrete Fourier Transform.

Fourier Transforms of Common Functions (Q1): Image source: The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D., Chapter 13: Continuous Signal Processing

Harmonics vs Output (Q2) Image source: OpenStax - Fourier Series Approximation of a Square Wave

[I discuss your 1010101010 data patterns at end of this.]

By the way, harmonics do not exist. They are just an artifact of the sinusoidal basis function used in Fourier Series.

For example: A single spike or impulse or a single fast edge ----- will not display harmonics. Why no harmonics? because some repetition is needed.

However, in a real world circuit with energy storage in the form of inductors and capacitors, you may have a narrow-band frequency response and thus a ringing time response whenever a single fast edge arrives.

You can see this effect, using a series resonant circuit that has moderate dampening (Q of 5 to 50), and a pulse generator with variable pulse width and/or variable frequency. Adjust the generator over a wide frequency range, and you'll find regions where a slight change in frequency or pulse width (duty cycle) causes dramatic change in the stored energy waveform across the inductor or capacitor.

What is happening?

Narrow-band circuitry act as CORRELATORS, having a memory for prior energy input and the phase of the prior energy input.

When your waveform is repetitive, your narrow-band circuit implements the correlation, and remembers phase information.

Stored energy causes inter-symbol-interference, and will degrade the data-eye to where there is no square-ness to the data-eye and thus no safe time to sample the voltage for making a decision. Beware of package inductances in high-frequency data transmission; the stored energy is not your bit-error-rate nor data-eye friend.

Some data transmission systems do superimpose multiple waveforms (Intel has tried this, to control the out-of-band energy content in their radios) to create useful peaks and nulls in response of the correlators. This requires very fast circuits.

For 101010 data patterns, which we can describe as "square waves" having exactly 50% duty cycle, only the ODD elements of the sinusoidal basis functions are needed.

As soon as non-50% duty cycles are needed, or you have random data streams, a mix of odd and even basis functions are needed.

Get access to a spectrum-analyzer and a pulse generator set to very weak output (less than 0.1 volt, so as to not damage the spectrum-analyzer). Then explore the spectrum, which is the coefficients of the basis functions, as you vary the RESOLUTION BANDWIDTH.

A wide resolution bandwidth destroys all information about the odd and the even energy contributions.

A narrow resolution bandwidth, which is akin to a precision correlator, lets you examine the ODD and the EVEN contributions.

Have fun.