DSPRelated.com
Forums

Gibbs

Started by Unknown October 26, 2014
So you model a square wave by the sum of sine waves. Suppose you take 5 or 6 and get the classic Gibbs phenomena. Now suppose that you know exactly where the 5th or 6th harmonic is and take the same square wave and pass it through a second - or higher order filter (analogue). You don't get Gibbs phenomena at all. All you get is the transient response (ie the convolution of the square wave and the filter). The difference is that you get ringing on the rising edge of the waveform (lets say) but it is not symmetrical as is the case for Gibbs. In fact if you calculate the output for the second order case you might even get the classic second order response for complex roots. So why the difference?

I assume this is all down to phase, the fact that we cannot easily simulate the effect or removing higher harmonics precisely with an analogue filter. Does this make sense? With with linear phase it may well work?
On Sun, 26 Oct 2014 15:48:45 -0700, gyansorova wrote:

> So you model a square wave by the sum of sine waves. Suppose you take 5 > or 6 and get the classic Gibbs phenomena. Now suppose that you know > exactly where the 5th or 6th harmonic is and take the same square wave > and pass it through a second - or higher order filter (analogue). You > don't get Gibbs phenomena at all. All you get is the transient response > (ie the convolution of the square wave and the filter). The difference > is that you get ringing on the rising edge of the waveform (lets say) > but it is not symmetrical as is the case for Gibbs. In fact if you > calculate the output for the second order case you might even get the > classic second order response for complex roots. So why the difference? > > I assume this is all down to phase, the fact that we cannot easily > simulate the effect or removing higher harmonics precisely with an > analogue filter. Does this make sense? With with linear phase it may > well work?
It has a lot to do with phase, and with causality (or apparent causality -- there's a recent thread with a lot of Sturm und Drang on the casual definition of "causal" (as opposed to the _formal_ definition of "causal")). When you take the first five or six harmonics of a square wave and add them up, in phase, you are creating the same effect as if you ran that square wave through a perfect boxcar (in frequency) filter with zero phase shift. Such a filter is non-causal (by both the formal and casual definitions), so what you see at the edges of the square wave is, in fact, the filter's ringing -- it's just that the filter's impulse response is infinite in time _in both directions_. In your analog filter case, you're using a filter that largely rings _after_ the impulse. I suspect that even an analog filter could show some pre-ringing, but I also suspect that any "reasonable" analog low-pass filter wouldn't. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim,
We have to remember when we say a filer is "ringing".... We are talking about linear systems and the filter does NOT create any frequencies that were not already present at the input. So the term filter ringing can be a little mis leading.

If the op made a wave using only the first 5 harmonics he will see ringing.
If started with a square wave and created a filter that chopped off all harmonics above the 5th and the filter did not alter the phase or amplitude of the harmonics it allowed to pass, the results would be exactly the same.

Even when you hit a bell ( or high q circuit) and it "rings" the bell does not CREATE any frequencies that were not present in the impulse used to "hit" the bell.

Mark

Mark
On Sun, 26 Oct 2014 18:12:21 -0700, makolber wrote:

> Tim, > We have to remember when we say a filer is "ringing".... We are talking > about linear systems and the filter does NOT create any frequencies that > were not already present at the input. So the term filter ringing can be > a little mis leading. > > If the op made a wave using only the first 5 harmonics he will see > ringing. > If started with a square wave and created a filter that chopped off all > harmonics above the 5th and the filter did not alter the phase or > amplitude of the harmonics it allowed to pass, the results would be > exactly the same. > > Even when you hit a bell ( or high q circuit) and it "rings" the bell > does not CREATE any frequencies that were not present in the impulse > used to "hit" the bell.
Well, yes. And to further complicate things, if you really had a "perfect" boxcar filter, the ringing you would see in response to a square wave input would be the same regardless of whether it cuts off at fundamental * 5.001, or fundamental * 5.999, even though the observed response to a step (or impulse) would be discernibly different. I don't think any of that changes the validity of what I said, however. -- www.wescottdesign.com
N0Spam@daqarta.com (Bob Masta) wrote:
> On Sun, 26 Oct 2014 19:00:02 -0500, Tim Wescott > <seemywebsite@myfooter.really> wrote: > >> On Sun, 26 Oct 2014 15:48:45 -0700, gyansorova wrote: >> >>> So you model a square wave by the sum of sine waves. Suppose you take 5 >>> or 6 and get the classic Gibbs phenomena. Now suppose that you know >>> exactly where the 5th or 6th harmonic is and take the same square wave >>> and pass it through a second - or higher order filter (analogue). You >>> don't get Gibbs phenomena at all. All you get is the transient response >>> (ie the convolution of the square wave and the filter). The difference >>> is that you get ringing on the rising edge of the waveform (lets say) >>> but it is not symmetrical as is the case for Gibbs. In fact if you >>> calculate the output for the second order case you might even get the >>> classic second order response for complex roots. So why the difference? >>> >>> I assume this is all down to phase, the fact that we cannot easily >>> simulate the effect or removing higher harmonics precisely with an >>> analogue filter. Does this make sense? With with linear phase it may >>> well work? >> >> It has a lot to do with phase, and with causality (or apparent causality >> -- there's a recent thread with a lot of Sturm und Drang on the casual >> definition of "causal" (as opposed to the _formal_ definition of >> "causal")). >> >> When you take the first five or six harmonics of a square wave and add >> them up, in phase, you are creating the same effect as if you ran that >> square wave through a perfect boxcar (in frequency) filter with zero phase >> shift. Such a filter is non-causal (by both the formal and casual >> definitions), so what you see at the edges of the square wave is, in fact, >> the filter's ringing -- it's just that the filter's impulse response is >> infinite in time _in both directions_. >> >> In your analog filter case, you're using a filter that largely rings >> _after_ the impulse. I suspect that even an analog filter could show some >> pre-ringing, but I also suspect that any "reasonable" analog low-pass >> filter wouldn't. > > Interesting speculation. I can't imagine an analog filter > with pre-ringing... how would it know when the edge was > about to arrive so that it could start its pre-ring?
All filters have some delay. Question would be whether it was enough delay.
> Even > digital filters can't really do this... we only see what we > call pre-ring when the overall response is delayed enough to > allow it. > > Best regards, > > > Bob Masta > > DAQARTA v7.60 > Data AcQuisition And Real-Time Analysis > www.daqarta.com > Scope, Spectrum, Spectrogram, Sound Level Meter > Frequency Counter, Pitch Track, Pitch-to-MIDI > FREE Signal Generator, DaqMusiq generator > Science with your sound card! >
-- Les Cargill
On Sun, 26 Oct 2014 19:00:02 -0500, Tim Wescott
<seemywebsite@myfooter.really> wrote:

>On Sun, 26 Oct 2014 15:48:45 -0700, gyansorova wrote: > >> So you model a square wave by the sum of sine waves. Suppose you take 5 >> or 6 and get the classic Gibbs phenomena. Now suppose that you know >> exactly where the 5th or 6th harmonic is and take the same square wave >> and pass it through a second - or higher order filter (analogue). You >> don't get Gibbs phenomena at all. All you get is the transient response >> (ie the convolution of the square wave and the filter). The difference >> is that you get ringing on the rising edge of the waveform (lets say) >> but it is not symmetrical as is the case for Gibbs. In fact if you >> calculate the output for the second order case you might even get the >> classic second order response for complex roots. So why the difference? >> >> I assume this is all down to phase, the fact that we cannot easily >> simulate the effect or removing higher harmonics precisely with an >> analogue filter. Does this make sense? With with linear phase it may >> well work? > >It has a lot to do with phase, and with causality (or apparent causality >-- there's a recent thread with a lot of Sturm und Drang on the casual >definition of "causal" (as opposed to the _formal_ definition of >"causal")). > >When you take the first five or six harmonics of a square wave and add >them up, in phase, you are creating the same effect as if you ran that >square wave through a perfect boxcar (in frequency) filter with zero phase >shift. Such a filter is non-causal (by both the formal and casual >definitions), so what you see at the edges of the square wave is, in fact, >the filter's ringing -- it's just that the filter's impulse response is >infinite in time _in both directions_. > >In your analog filter case, you're using a filter that largely rings >_after_ the impulse. I suspect that even an analog filter could show some >pre-ringing, but I also suspect that any "reasonable" analog low-pass >filter wouldn't.
Interesting speculation. I can't imagine an analog filter with pre-ringing... how would it know when the edge was about to arrive so that it could start its pre-ring? Even digital filters can't really do this... we only see what we call pre-ring when the overall response is delayed enough to allow it. Best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!
On Mon, 27 Oct 2014 13:32:56 +0000, Bob Masta wrote:

> On Sun, 26 Oct 2014 19:00:02 -0500, Tim Wescott > <seemywebsite@myfooter.really> wrote: > >>In your analog filter case, you're using a filter that largely rings >>_after_ the impulse. I suspect that even an analog filter could show >>some pre-ringing, but I also suspect that any "reasonable" analog >>low-pass filter wouldn't. > > Interesting speculation. I can't imagine an analog filter with > pre-ringing... how would it know when the edge was about to arrive so > that it could start its pre-ring? Even digital filters can't really do > this... we only see what we call pre-ring when the overall response is > delayed enough to allow it.
I hate it when I'm not clear... Yes, I meant an analog filter that has a delayed overall response. I'm not sure if there's any earthly reason to build one other than to say that you've done it -- except maybe for the old analog scopes that had delay lines? At any rate, I was trying to say that while you COULD build such a filter, you probably never WOULD. -- www.wescottdesign.com
On Mon, 27 Oct 2014 13:32:56 +0000, Bob Masta wrote:

> On Sun, 26 Oct 2014 19:00:02 -0500, Tim Wescott > <seemywebsite@myfooter.really> wrote: > >>In your analog filter case, you're using a filter that largely rings >>_after_ the impulse. I suspect that even an analog filter could show >>some pre-ringing, but I also suspect that any "reasonable" analog >>low-pass filter wouldn't. > > Interesting speculation. I can't imagine an analog filter with > pre-ringing... how would it know when the edge was about to arrive so > that it could start its pre-ring? Even digital filters can't really do > this... we only see what we call pre-ring when the overall response is > delayed enough to allow it.
So, here I spin off into useless trivia-land: If you have a differential equation for an analog filter which is unstable when interpreted as a causal system, i.e. d^2 x ----- = a^2 * x dt^2 In order to interpret it as a non-causal system, while maintaining mathematical "correctness", do you need to do anything other than to hold your mouth differently? IOW, can you just say that the homogeneous solution is x_h(t) = A * (e^(a*t) for t < t0) + B * (e^(-a*t) for t >= t0), and then carry on to solve it "normally"? This would certainly ease the control of the inverted pendulum if you could! -- www.wescottdesign.com
On 10/27/14 10:56 AM, Tim Wescott wrote:
> On Mon, 27 Oct 2014 13:32:56 +0000, Bob Masta wrote: > >> On Sun, 26 Oct 2014 19:00:02 -0500, Tim Wescott >> <seemywebsite@myfooter.really> wrote: >> >>> In your analog filter case, you're using a filter that largely rings >>> _after_ the impulse. I suspect that even an analog filter could show >>> some pre-ringing, but I also suspect that any "reasonable" analog >>> low-pass filter wouldn't. >> >> Interesting speculation. I can't imagine an analog filter with >> pre-ringing... how would it know when the edge was about to arrive so >> that it could start its pre-ring? Even digital filters can't really do >> this... we only see what we call pre-ring when the overall response is >> delayed enough to allow it. > > So, here I spin off into useless trivia-land: > > If you have a differential equation for an analog filter which is > unstable when interpreted as a causal system, i.e. > > d^2 x > ----- = a^2 * x > dt^2 > > In order to interpret it as a non-causal system, while maintaining > mathematical "correctness", do you need to do anything other than to hold > your mouth differently? IOW, can you just say that the homogeneous > solution is > > x_h(t) = A*(e^(a*t) for t < t0) + B*(e^(-a*t) for t >= t0), >
well, in fact, both terms satisfy the diff eq for all t. and the breakpoint or discontinuity that happens at t0 does *not* satisfy the diff eq.
> and then carry on to solve it "normally"? > > This would certainly ease the control of the inverted pendulum if you > could!
well, you could just run time backwards and the inverted pendulum would appear stable. gravity would work backwards which would stabilize the inverted pendulum because it would be "hanging" **up** and, as in this particular Calvin and Hobbes comic strip, we would start falling off of the surface of the planet. wouldn't that be cool? it's one reason i don't like to think too much about these ROC issues. they seem sorta pointless in practice. one exception maybe is the Wang and Smith Truncated IIR filter paper where they implement a linear-phase "IIR" by cascading the stable IIR with the poles inside the unit circle with the unstable counterpart with the poles and zeros mirrored. then they do some ping-ponging because even an *truncated* unstable IIR will eventually blow up on the inside enough so that the blow up shows in the output because of numerical limitations. i would not bother with an unstable TIIR, but rather use stable TIIRs with the Powell-Chau segmented filtfilt() thing to get linear-phase "IIR" filtering. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
anlaog filters that also include "delay equalizers" can "pre-ring"

Of course the ring does not start before the input.  The ring starts after the input and the delay equalizer delays the main output after that.
This was a common feature of analog video low pass filters that included a delay equalizer.

The ONLY way to eliminte the ringing all together is to make the transition from the passband to the stopband more gradual.  You can fuss with the delay and move the ringing before or after the main response but to REDUCE the ringing the ONLY choice is to make the transition more gradual.

The facts are the same for digital or analog filters.

Mark