# Gibbs phenonemon in real life

If I feed a square wave into a first order, passive, low-pass filter (resistor and capacitor), I get the following results on an oscilloscope (sorry, I don't know how to scale and rotate images):

Why does the overshoot only occur on half of the corners of the square wave? Based on Fourier analysis, partial sums of a square wave should look something like this:

This is the Gibbs phenomenon. Here the overshoot occurs on all 'corners' of the square wave, rather than just the ones following a transition. I got some similar results when testing the frequency response of a unity gain buffer op amp:

Hypothetically, the op amp acts as a low-pass filter due to its finite bandwidth, so it's not surprising that it produces similar results to the actual low-pass filter above.

My question is: based on electrical theory, low-pass filtering should produce a square wave with attenuated higher harmonics, which should produce something similar to the Gibbs phenomenon with overshoot at each of the corners. Why doesn't this happen here? For me, it makes MATHEMATICAL sense that the output wave should have overshoot at each corner, but it makes INTUITIVE sense that the output should only have overshoot at the corners that occur after a transition. Why? Because if the 'ringing' (overshoot/undershoot) also occurred BEFORE a transition, it would seem non-causal - it would almost be as if the wave is guessing that it's about to transition!

How can I reconcile my understanding from the perspective of Fourier theory with what actually happens in real life?

• You're more likely looking at an improperly compensated probe than a Gibb's phenomenon Commented Aug 16, 2018 at 2:24
• Gibbs phenomenon is because of summation of frequency components of the Fourier series. It's more than just overshoot. You're not doing anything that should result in Gibbs phenomenon. Commented Aug 16, 2018 at 2:29
• Try moving the 'scope probe ground lead with a separate short (1"-ish) wire right to the end of the capacitor instead of wherever it it going now. Commented Aug 16, 2018 at 2:31
• A first order (RC) filter by itself does not produce ringing. The ringing you are seeing is caused by parasitic L and C somewhere. It is even possible that the ringing occurs in the 'scope probe, but not in the actual circuit. It is very common to see phantom ringing on oscilloscope plots of a square wave. Commented Aug 16, 2018 at 3:19
• Simple enough, Gibbs phenomenon is anticausal and hence cannot be realised. It's just a theoretical effect coming from as physically not realisable filtering Commented Aug 16, 2018 at 7:25

I figured it out! I created a MATLAB script which sums the first 1000 terms of the output's Fourier series with a 1Hz square wave input. Here's the answer:

Low-pass filters can cause the Gibbs phenomenon to occur, but these filters are not physically realizable. (This makes sense, otherwise non-causal behavior would be possible). Consider a brick wall filter. This is equivalent to truncating the Fourier series of the input to a certain maximum frequency. The results of the MATLAB script verify this:

As mkeith said in the comments, a perfect first order RC filter does not produce ringing. Instead, the filter just 'rounds off' the square wave:

The filter that I created was a first order filter, but parasitic elements, bad probes, etc. must have produced the ringing/overshoot, since as the result from MATLAB above shows - first order low-pass filters do not produce ringing.

However, second order (RLC) low-pass filter can produce ringing! The MATLAB script verifies this:

You'll notice that there is no non-causal behavior occurring here. This second-order filter is physically realizable (neglecting parasitic elements, but even then this behavior should be able to be approximately reproduced).

This means that the reason I was confused was simply because I didn't do the maths! I assumed that the Gibbs phenomenon would apply to a first order filter despite the fact that phase-shifting and attenuation occur in a first order filter which do not occur when truncating the Fourier series.

• Please take some time to read and digest all the comments to your OP. You'll get to understand that Gibbs phenomenon has nothing to do with it. Commented Aug 16, 2018 at 8:07
• truncating harmonics –the Fourier series Commented Aug 17, 2018 at 15:57

simulate this circuit – Schematic created using CircuitLab

## Non-causal system

• anticipates the future values.
• the present change depends on future changes

The 2nd signal above in red is a screen copy of Falstad's Fourier analysis of a square wave. With a slider option for truncated harmonics, the resulting signal is shown in red a ringing before the transition. This an example of non-causal. However, a real brick wall filter has a large phase shift and group delay which causes the amplitude changes to occur only AFTER the input change.

This makes a real filter, a causal system as opposed to truncating a Fourier series.

• It is an answer, but laconic. It says: adjust C1 and watch the waveforms change shape from exponentially rising, to square, to exponentially peaking. But, I agree, some words could have been added, given the OP's content. Commented Aug 16, 2018 at 8:06
• @aconcernedcitizen i understand what you're saying, but to the majority of people, they will just see pictures with no explanation. To me, that isn't a good answer. Therefore it is not a useful answer, hence my -1. I see it as almost the same as a 'Link only' answer. It needs some text and an explanation to be considered useful
– MCG
Commented Aug 16, 2018 at 8:32
• For the record, the correct answers are beside each photo. If I have time , I’ll explain why a C ratio error looks similar but different to a probe ground resonance overshoot. This is one case where the OP is wise enough to know Gibb’s so I left out fundamentals he should know. Commented Aug 16, 2018 at 11:43
• @Gregory I'm not thinking others are more 'stupid' at all. That's a silly assumption. Any answers that are just pictures with no explanations are not good answers. Simple as that. An explanation will help anyone understand. I'd say that on any question, no matter how simple or difficult it is
– MCG
Commented Aug 17, 2018 at 16:13
• Yes. I did say the majority of people. The majority of people probably would want explanations. And yes, short and clear is good. This is short but not clear to most as it has no explanations. It is just pictures. Which makes for a bad answer
– MCG
Commented Aug 17, 2018 at 18:25