2

Using the figure below as an example, I wonder if it is possible that the small oscillations in the signal at the time of each step shift could be caused solely by the application of a low-pass filter to a pure square wave?

Signal image

CaptainProg
  • 465
  • 2
  • 6
  • 7

2 Answers2

6

These ringing artifacts are due to the Gibbs phenomenon. They are indeed caused by lowpass filtering a function with discontinuities. What you see is basically the oscillations of the step response of the lowpass filter. The oscillations can be reduced (or completely eliminated) by choosing a lowpass filter with less or no ringing in its step response. E.g. a Gaussian filter has no ringing at all. However, lowpass filters with well-behaved step responses perform worse in the frequency domain in terms of passband deviation, transition band roll-off, and stopband attenuation.

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • Matt - Not sure this is 100% correct. Please look at my answer - one of us must be slightly wrong. – Izhaki Jul 03 '13 at 21:11
  • 1
    @Izhaki: so where do you think we disagree? – Matt L. Jul 03 '13 at 21:50
  • In the statement " The oscillations can be reduced (or completely eliminated) by...". My claim is that the oscillations will happen regardless of the filter used. – Izhaki Jul 03 '13 at 22:04
  • 2
    Izhaki is claiming that the Gibbs phenomenon is fundamental to low pass filtering. Matt L is correctly pointing out that the Gibbs phenomenon is caused by ripples in the impulse response of the filter. Gaussian filters do not have ripples in their impulse response: http://dsp.stackexchange.com/questions/3002/why-are-gaussian-filters-used-as-low-pass-filters-in-image-processing/7792#7792. – Wandering Logic Jul 03 '13 at 22:08
  • Ah, I see your point now. I guess it all depends on how you define a lowpass filter. If you refer to ideal lowpass filters, or to filters closely approximating ideal brickwall filters, then it's true that you'll always get oscillations at discontinuities. However, you can design "less radical" lowpass filters with no oscillations, albeit at the expense of frequency domain characteristics. – Matt L. Jul 03 '13 at 23:54
  • 1
    @WanderingLogic: Also http://dsp.stackexchange.com/q/9745/29 – endolith Jul 06 '13 at 06:14
1

I think it is worth pointing out that any lowpass filter will reshape a pure square wave to something like in your illustration, regardless of the filter being used.

Reason is that a pure square wave requires an infinite amount of harmonics (a square wave is made of a fundamental frequency and odd harmonics at a level of 1/h). The moment a lowpass filter is applied - you no longer have infinite amount of harmonics, thus these ripples start popping out.

In the following illustration, only 5 sine harmonics are shown, but the sum (resembling square wave) is that of 60. You can see the ripples there as well. The way to get rid of them is to carry on adding harmonics ad infinitum. If you do so and then apply a lowpass just above the 60th harmonic - you'll get something similar to the square in this illustration:

enter image description here

Izhaki
  • 319
  • 1
  • 7
  • This is an interesting, if incomplete, argument. You are only considering the amplitude of the low passfilter. Many lowpass filters also have non-trivial phase and thus not only the amplitude but also the relative positions of the harmonics are changed. More often than not, this will reduce Gibbs phenomon. Your picture is also wrong since it doesn't show the alternating sign of the harmonics. If you add them all up with the same phase you get no square wave at all. – Hilmar Jul 04 '13 at 08:13
  • The graph was generated by presenting each of (1/h)*sin(hx), and the sum of which - how can it be wrong? Also, while I might be overlooking something big time, I didn't know that the harmonics of a squarewave alternate - seems by the illustration that they aren't. – Izhaki Jul 04 '13 at 09:05
  • Odd harmonics only, I should add. – Izhaki Jul 04 '13 at 09:37
  • Sorry, my bad. You only need to alternate signs if you use a cosine expansion that's symmetric around t = 0. For a sine expansion you just add the sines directly and get x(-t) = -x(t). – Hilmar Jul 04 '13 at 10:23