Band-pass filtering: FAIL!

Last time on the subject of the MetriGear Vector, I posted some comments on filtering noisy data. Honestly, I hope my college professors weren't reading that one.... I might find myself back in school having had my undergraduatee EE degree revoked. 6.003 redux.

What I'd proposed was exponential smoothing followed by differentiation. Exponential smoothing is a convolution with an exponential function. The result is, where f*(t) is the smoothed function, and f(t) is the original function:

f*(t) = (1 / τ) ∫ d Δt · exp(‒Δt / τ) f(t ‒ Δt),

where the integral is from 0 to ∞.

In this case, where we're dealing with pedaling motion, pedaling at constant cadence yields a sinusoidal motion. For example:

f(t) = f0 sin ωt,

where ω is the angular velocity. For those of us who were never very good at memorizing integration tables, it's easier to express the sin function in terms of its equivalent in complex exponentials, where i is the unit imaginary number:

f(t) = f0 [ exp iωt ‒ exp ‒iωt ] / 2i .

Okay, so I can plug this in:

f*(t) = (1 / τ) f0 ∫ d Δt · exp(‒Δt / τ) [ exp iω(t ‒ Δt) ‒ exp ‒iω(t ‒ Δt) ] / 2i .

I can then consolodate the exponentials:

f*(t) = (1 / τ) f0 ∫ d Δt · [ exp(iω(t ‒ Δt) ‒ Δt / τ) ‒ exp(‒iω(t ‒ Δt) ‒ Δt / τ)] / 2i .

Exponentials even I can integrate, recalling the limits of integration are 0 and infinity, only the former explicitly contributing (fingers crossed I got the signs correct):

f*(t) = f0 [exp(iωt) / (1 ‒ iωτ) ‒ exp(‒iωt) / (1 + iωτ)] / 2i.

Clear the complex denominator:

f*(t) = f0 [exp(iωt) (1 + iωτ) ‒ exp(‒iωt) (1 ‒ iωτ)] / 2i (1 + ω²τ²),

which if you squint hard is clearly:

f*(t) = f0 [sin(ωt) + ωτ cos(ωt)] / (1 + ω²τ²).

This is another oscillating function, out of phase with the original function. If ωτ « 1, then f*(t) ≈ f(t), as expected. On the other hand, if ωτ » 1, then f*(t) ≈ cos(ωt) / ωt.

Thus the exponential smoothing function acts like a low-pass filter: for ωt large the amplitude of the result is inversely proportional to the frequency. All good.

The rub is when we differentiate it. To keep the units the same I'll multiply the derivative by τ.

τ (∂ / ∂ t) f*(t) = f0 [cos(ωt) ‒ ωτ sin(ωt)] ωτ / (1 + ω²τ²)

Now you see at high frequencies this result goes to cos(ωt): independent of frequency. So this net operation of exponential smoothing followed by differentiation isn't a band-pass filter at all. Rather it is just a high-pass filter. For frequencies ωτ « 1, the output magnitude is proportional to ωτ, but for ωτ » 1, the output is the same magnitude as the input.

This is why the exponential smoothing followed by differentiation did such a poor job of eliminating high-frequency noise. I proposed in that previous post that another smoothing function might do better. Enough for now.

One final note: all of this could have been quickly concluded had I remembered my LaPlace transforms. But LaPlace transforms are a bit on the abstract side. Better to boldly dive in and do the integrals. The conclusion was the same.

Comments

Popular posts from this blog

Proposed update to the 1-second gap rule: 3-second gap

Post-Election Day

Marin Avenue (Berkeley)