# Why output of square wave signal after bypass capacitor is a triangular wave?

I understand square wave contains many sine waves of different frequencies as so does triangular wave. My impression with bypass capacitor is that the higher the frequencies the better it attenuates those signals. Therefore, I hope to see a fundamental sine wave output for both square wave and triangular wave input. However, in reality, at high frequencies, output from triangular wave is a perfect sine wave ; but output from square wave is a perfect triangular wave.

At medium frequency, output from square wave looks like exponential charging & discharging curve, that one I can understand. But what I don't understand is its output at high frequency. Why is it so ?

My circuit setup is simple, small amplitude signal fed directly into capacitor to ground. Output is taken from capacitor too.

Here is the circuit setup, very simple: The above observation can be seen on all capacitor ranges, however, it is easier to see on not so small capacitor like 0.1uF. In short, at high frequency, output from square wave turns into a triangular wave.

• Post a schematic so we can see what's going on. – Matt Young Nov 11 '12 at 3:25
• What frequency range does the triangular wave appear at? Also, what capacitors are being used? What is their leakage current / ESR? – Anindo Ghosh Nov 11 '12 at 4:33
• In your schematic, is the source a voltage source or a current source? If it's a voltage source, did you define an internal resistance? If it's a perfect voltage source, there's no explanation for what you saw. A square wave in should give a square wave out. – The Photon Nov 11 '12 at 5:45
• It's a function generator with internal impedance. Output is not the same as input in this case. In fact, it is impossible to put both input & output on oscilloscope because of the bypass capacitor routing high harmonics to ground. – user1502776 Nov 11 '12 at 5:56

The Fourier series for a triangle wave is Odd harmonics shift in phase by 90 deg from a square wave with 12 dB/ odd octave more attenuation. and the square wave Both have only odd harmonics but differ in the slope of the peak value for each harmonic. However triangle harmonics are much smaller. As n increases, the amplitude reduces by 1/n², whereas a square wave reduces by 1/n. Triangle waves harmonics also alternate phase (+/-sin) with increasing n.

To simplify my explanation, the capacitive load on a 50Ω gen. gives a frequency response or Transfer Function of; , which you know gives the exponential time response to a medium square wave where f is near 1/RC .

But for high frequency where RCs>>1 so the transfer fcn reduces to an integrator Hc(s)=1/RCs transfer function.

Applying this filter to the Fourier series of the square wave, its 1/n harmonic attenuation becomes 1/n² slope on harmonics of the triangle wave. Similarily the triangle wave source when filtered, its harmonic attenuation slope of 1/n² becomes 1/n³.
On a scope all you would see is a sine wave, but on a spectrum analyzer log scale you would see the 1/n³ slope of all harmonics ( i.e. 3rd order slope )

side comments added I believe there is value in the time you spend in the lab to match theory with practise. When it does not match, look at for a better equivalent circuit then verify your assumptions. If you have Java you can play with this programmable signal generator . Have fun ! Spend more time in the lab validating what you learn and bring the lab to your desktop then expand your horizons.

use the mouse pointer and left or right click...drag and adjust

• Change the phase of the Fourier series and see the effect on a triangle wave
• Add a spurious resonance in the amplitude of one harmonics, see the waveform
• add a glitch, change the shape anyway you want. (arbitrary waveform)
• add a LPF filter, change the frequency, slide the number of terms in the spectrum, see effect

When Integrate a step input and Dump, you get a Sawtooth waveform Here the mouse is hovering over the fundamental of the Fourier spectrum and the fundamental sinewave amplitude and phase are shown in yellow. Meanwhile I boosted a harmonic to similate a resonance on the sawtooth.

The combinations are "only limited by your imagination"

• Excellent explanation ! I thought what hoped to see was only the fundamental sine wave for each square & triangular wave. But it turns out their harmonics cannot be diminished and they contribute to the final output shapes even at high frequency. I wonder if I keep increasing the frequency (assuming the scope is sensitive enough for low amplitudes), Could I get rid of all harmonics leaving the fundamental as the only one left (sine wave) ? – user1502776 Nov 11 '12 at 6:13
• If you think that read the above again. An integrator will always be a 1st order filter. no matter high high freq, the slope of the harmonics will not change until other parasitic filters increase the order of the LP filter. – Sunnyskyguy EE75 Nov 11 '12 at 14:53
• No answer is perfect, but thanks for the comment. Although I think the Java App is as close to perfect for fundamental interactive teaching between time and frequency domain, so you can memorize the patterns and recognize them later after you have done all the basics of math transforms to understand why it works in school. – Sunnyskyguy EE75 Nov 12 '12 at 13:12

Here is a seat-of-the-pants explanation. The beginning part of the exponential curve, before it starts to "level off", looks very much like a straight line. At high frequencies, you don't get very far up that curve before the signal reverses and heads the other way. If you look carefully, you'll see the lines of the triangular wave aren't quite straight, just close to it.

Chances are, the sine wave you get from the triangular wave isn't quite perfect, either, but that's hard to see without a distortion analyzer.

• That's quite an explanation , :) – user1502776 Nov 11 '12 at 6:38
• It is intuitively accurate, and if you get f far enough higher than 1/RC it will be perfectly linear! As we know from the ideal cap is a true integrator from the impedance equation. You know from basic calculus when you integrate a square wave, the area under the square is always a true triangle wave ( so long as f/RC >>1 ) – Sunnyskyguy EE75 Nov 11 '12 at 15:16