# Gibbs phenomenon and ringing in square waves: causality?

 P: 10 A seemingly good way to understand the overshoot and decay (ringing) of a square wave on a scope is that it is the result of bandwidth limiting. In that case, the Fourier series of a square wave $$\Pi(t) = \frac{1}{2 \pi} \sum_{n=-\infty}^\infty \frac{\sin(n \omega/2)}{n \omega/2} \exp(i n \omega t)$$ shows the well-known overshoot when n is only taken to a small number, such as 30, terms. It's obtained by Fourier transforming the rect function $\Pi(t)$ to get $\mathrm{sinc}(\omega)$, then transforming back to the time domain, except you form a Riemann sum instead of an integral and take finite terms. But this calculation doesn't reproduce what you really see on a scope, because it appears to be non-causal. That is, before the machine that drives the signal starts to apply voltage (at $t=-5$ in the plot), this curve is already ringing. There's a few references to the causality being related to the Kramer's-Kronig relations, especially in the "Understanding the Kramers-Kronig Relation Using A Pictorial Proof" white paper availble online (here). In that they suggest forming a causal function, where it is zero for all $t < 0$, which we could do by translating the rectangle function so that its rise is at $t=0$. Then form even and odd functions out of the signal. When you do this, the odd function is the same as the even function times $\mathrm{sgn}$. However, this seems to be of little help, particularly because finding the Fourier transform of the odd part $$h_o = \mathrm{sgn}(t) h_e = (1/2) \mathrm{sgn}(t) \Pi(t)$$ involves a convolution of $\mathrm{sinc}$ and $1/i \omega$, which is quite difficult (Wolfram integrator gives an answer that is not pure imaginary, which shouldn't be true). What am I missing here? Is there a way to present the real signal you see on a scope trace as an instance of the Gibbs phenomenon? If so, is this on the right track? Does anyone know of a treatment of this problem? Thanks! Attached Thumbnails
P: 3,252
 But this calculation doesn't reproduce what you really see on a scope, because it appears to be non-causal
You clearly can't hear a bell ring before it's struck.

I've not seen real scope traces that look like your "ideal". They normally look like these from the web..

http://www.craigsarea.com/images/good_gate.jpg
http://www.chatzones.co.uk/discus/me.../1218/2480.jpg
http://i.stack.imgur.com/Q0uig.png

Dual beam scope traces can sometimes be misleading because of the way sync and chop/sweep works. The input and output wave form can be shifted so they appear to be non causal. It's not always obvious what feature of an input wave caused what feature in the output.
Thanks
PF Gold
P: 12,256
 Quote by CWatters You clearly can't hear a bell ring before it's struck. I've not seen real scope traces that look like your "ideal". They normally look like these from the web.. http://www.craigsarea.com/images/good_gate.jpg http://www.chatzones.co.uk/discus/me.../1218/2480.jpg http://i.stack.imgur.com/Q0uig.png Dual beam scope traces can sometimes be misleading because of the way sync and chop/sweep works. The input and output wave form can be shifted so they appear to be non causal. It's not always obvious what feature of an input wave caused what feature in the output.
You should always ascertain what the scope is actually triggering on. Most scopes default to 'Alternate Sweep' (one trace at a a time). If it is on 'Auto trigger' then the fast leading edge in each case sill probably be the time reference for each trace as it is displayed; they will appear to coincide. If you can actually 'trigger on A channel' (or B), then that should show you the two traces in 'real' time relation to each other. Failing that, split the source signal and feed it to the External sync input and sync on that.

For low frequency waveforms it is sometimes possible to 'Chop' between inputs and that will also give the right relative timing (but the chop frequency needs to be a lot higher than the signal repetition frequency.
The actual delay through a filter will be at least as long as the impulse response of the filter, looked at in the time domain.You can never have the cart arrive before the horse.

P: 10
Gibbs phenomenon and ringing in square waves: causality?

 Quote by CWatters I've not seen real scope traces that look like your "ideal". They normally look like these from the web..
That was my point; you never get the ideal. When properly measured with a scope, they look like the third picture you linked to. That is, they look like neither of the plots that I drew. They almost look like the approximate curve, which is due to bandwidth limitation caused by parasitic capacitance, inductance, and resistance. Looking at a low duty cycle pulse (so that previous transient behavior has totally died down by the next pulse) given by machines made by DEI, BNC, and Stanford, you always see the ringing behavior. They're real and understandable. One way you can replicate them is to do a SPICE analysis of a square wave pulse and inserting a parasitic circuit. You get ringing. But people say that it's a Gibbs phenomenon example, and I'm having trouble rationalizing the fact that the Gibbs phenomenon predicts noncausal behavior which isn't observed.

Put simply, how can you calculate the trace in the third pic that you linked to?
P: 3,252
 Quote by RGann That was my point; you never get the ideal.
It's a long time since I studied this but look up how digital filters work.

In a simple digital filter the output at time t is a function of samples either side of t. Clearly a real world, real time filter can't be forward looking (non-causal) so a delay has to be introduced. That delay modifies the response and makes the output appear causal.

http://paulbourke.net/miscellaneous/filter/

As I said it's been awhile. Perhaps someone has a better explanation.
Thanks
PF Gold
P: 12,256
 Quote by CWatters It's a long time since I studied this but look up how digital filters work. In a simple digital filter the output at time t is a function of samples either side of t. Clearly a real world, real time filter can't be forward looking (non-causal) so a delay has to be introduced. That delay modifies the response and makes the output appear causal. Google found this article but it's not a great answer/explanation. http://paulbourke.net/miscellaneous/filter/ As I said it's been awhile. Perhaps someone has a better explanation.
As I remember, there are Finite Impulse Response temporal filters where the delay is defined by the length of the memory and Recursuve Filters with feedback. The response for those takes time to establish itself on a repeating function. That can give you apparent non causal effects that aren't really.
 Engineering Sci Advisor HW Helper Thanks P: 7,284 I think the basic issue here is that in any real-world circuit that acts as a filter, the time delays (or phase changes) are different for each component of the signal. It is possible to design digital FIR (finite impulse response) filters that don't introduce relative phase differences, but the filter introduces a finite time delay between the input and the output. That would shift the "approx" trace in the OP's plot to the right, and preserve causality. Of course if such a filter is used "off line", i.e. not for real time processing, there is no reason why it has to be causal, and the output can be time-shifted to look exactly like the OP's plots. Real world analog circuits always introduce frequency-dependent time shifts. Even a simple "piece of wire" acts like an LCR circuit, not like an ideal resistor.
 Sci Advisor Thanks PF Gold P: 12,256 You need to be careful about what you mean by 'causal'. For a start, to discuss causality here, you can only talk in terms of a single pulse, in time and not a repeating pulse (what you normally see on a 'scope. The Fourier transform of a repeated wave shape involves sinusoids that are in existence for infinite time (strictly). The ringing that looks as if it starts 'before' the pulse 'was always there' before the pulse, even for the original rectangular pulse. It was just being modified by a load of other sinusoids so that the Sum was zero, at all times, except during the pulse. If you filter off the higher harmonics, the cancellation is incomplete so that 'ringing frequency' becomes visible. This is nothing to do with causality. Yet again, there is no paradox.
 P: 10 I've pored over a few treatments of the problem in available texts at the library. Abdul Jerri has a book on the Gibbs phenomenon, and discusses the non-convergence of the series even in the large limit (point convergence is guaranteed, but the curves do not have this feature). He points out that as the filter window opens, the overshoot does not go away, it simply moves closer to the point discontinuity, remaining at about 9%. All of his plots (and there are several) demonstrating overshoot of the sgn(t) function begin at t=0, and so he elides the question. Something else I noticed in my reading (do not have the reference ATM) was the technical point that even without a true step discontinuity, the Gibbs phenomenon still rears its head. This is fortunate, since I've yet to find a 0s-rise-time generator. The text then introduces the Hilbert kernel, purportedly relevant, but drops it after just a few pages. I guess my inherent prejudice is toward the observations I've made in my work. A 900 V pulser that I work with daily clearly shows this effect of overshoot, and never shows any such behavior before the pulse begins (the duty cycle is quite low). This is simple to understand from a circuit point-of-view; a TTL pulse turns on an FET on the rising edge, and a DC supply quickly energizes the output. Until this TTL pulse is sent, the system would have no knowledge that something is about to happen. Perhaps my usage of "causality" is imprecise.