# Are square wave really square or are they always relative approximations using harmonics

I'm studying the properties of waves through different mediums, and got hung up on this.

1. Is a square wave always a sum of harmonics or can we produce a square wave by quickly changing voltage? Is using harmonics the only way to produce a square wave in the real word not simulations , such as a digital signal through a wire, or is this just one method.

2. How square can we make the wave without harmonics? Will it be efficient as a digital signal?

-
Are you asking about theory or practice? Because in theory the two are the same; but in practice they're not. – Dan Neely Nov 16 '12 at 15:57

1) If you are thinking of harmonics as sinusoidal waves, well yes, ALL waveforms are (can be described as) sum of harmonics. This is essentially the idea of the Fourier analysis.

The problem is that to exactly reproduce a desired waveform you need in general an infinite number of harmonics. This is for instance the case of square waves. So in reality you only use an finite number of harmonics if you want to approximate a square wave. BUT.. summing a large number of harmonics (with the correct amplitudes/phases) in order to produce a square wave is cumbersome, so the practical way of producing a square wave IS by quickly changing voltage (think of opening and closing a switch periodically).

2) This will not produce an exact square wave, because to produce an exact square wave you would need the circuit to have an infinite bandwidth, which is impossible to achieve. Essentially your circuit will always behave as generator of a theoretically exact square wave with in series a filter that will not allow the highest frequencies to be transmitted, and the impulse so produced will therefore be a "almost square" wave.

How good this is depends on what you require, i.e. if you want to generate a very precise square wave you need a more sophisticated "switch" (i.e. fast switching circuits, high frequency electronics). On the other hand if what you need to generate is going to be used in an experiment where you will only be interested/able to measure frequencies up to F, your "square wave" doesn't need to be exactly square, but only "almost square" i.e. containing frequencies up to F.

For some ideas about electronic circuits, check this book, it is an old but respected source.

EDIT: to clarify better the answer to part 2), you practically never produce a square wave (or any other waveform) by summing harmonics, but you use a special circuit that produces the desired waveform (search Wikipedia for "astable multivibrator" for a circuit generating square waves). And given enough resources you will be able to achieve a "as square as desired" (albeit not exactly square) wave..

-

Is a square wave always a sum of harmonics or can we produce a square wave by quickly changing voltage?

From a synthesis point of view, a square wave can be synthesized via the summation of an infinity of sine waves of appropriate frequency, phase and amplitude.

From an analysis point of view, a square wave can be decomposed into an infinity of sine wave components of appropriate frequency, phase and amplitude.

So, if the system does not have a bandwidth extending to infinity, it cannot produce a genuine square wave regardless.

Consider the domain of electric circuit signals; voltage and current waveforms.

Since any physical circuit forms a loop of finite extent, the circuit has inductance. Thus, the current in the circuit must be continuous.

Similarly, any physical circuit has capacitance due to separated conductors. Thus, the voltage across the conductors must be continuous.

Since a genuine square wave is discontinuous, a physical voltage or current waveform cannot be an ideal square wave.

-

How square can we make a square wave? Mostly it's a matter of rise time and fall time - how quickly the voltage transitions from one level to the other. Easily a few nanoseconds, and with the right parts, a fraction of a nanosecond. I was routinely making and measuring voltage pulses of half a nanosecond width - and that was back in the 1980s.

When it comes to light, photonics researchers can make and measure pulses measured in dozens of picoseconds. There was an article in an optics magazine just a couple weeks ago - light pulses less than a picosecond wide. This is touching the low end of infrared. Now that's not dealing with square waves, but Gaussian pulses. A bunch of those can be synthesized to make any shape of wave you like. If you want a voltage varying as a square wave of any frequency with nice sharp sides transitioning in a picosecond, it's feasible.

There is also a question of how flat the tops and bottoms should be. There's nothing profound to say here; just be careful of stray inductance and capacitance, impedance mismatches, and such. In terms of synthesis math, watch out for the Gibbs effect when using less than an infinite number of harmonics.

-

Nothing in the real world can be completely discontinuous. To have an exact square wave there would have to be a sum of harmonic frequencies up to infinity but for any material object made out of atoms that is not possible. Also in any real circuit higher frequencies are attenuated more than lower frequencies so the wave will become less and less square as it propagates.

-
When you say propagates, are different parts of the wave (either voltage or current differences) across a wire at the same time. Or is the voltage or current of the wire changing constantly as a whole to create the wave? – rubixibuc Nov 16 '12 at 1:03
I am not an electrical engineer, but in general to know exactly what happens the electrical properties of the circuit that is trying to put the square wave on the wire, the electrical capacitance and inductance of the wire (which depends on the environment of the wire) and the electrical properties at the other end of the wire will all together the exact waveform of the current and voltage symbol. I don't think there is anything that can be said in general without knowing more about the circuit. For example, a coax cable will have different properties than a single wire. – FrankH Nov 16 '12 at 1:14