2
$\begingroup$

I am currently in need for filtering accelerometer data for an Android application. First of all, I used a simple low-pass filter (simple infinite impulse response filter) as follows:

for i from 1 to n
   y[i] := y[i-1] + α * (x[i] - y[i-1])

This helped me achieve a smoother result.

Then I decided to play with FFTs. I used a fast-fourier transform to get the signal into frequency domain and then zeroed some of the high frequencies. Then using inverse fourier transform I recreated the signal. This all worked fine and I know that the FFT and IFT implementations are fine. However, the signal wasn't as smooth as the one that I got from before using the simple infinite impulse response filter. I tried zeroing some further frequencies but didn't give me as good of a result as expected.

What is the reason behind this? I though using FFTs and IFT should technically give me a nice smooth graphs. Is this because of the sampling in FFT?

Thanks

$\endgroup$
1

1 Answer 1

7
$\begingroup$

There are three potential problems with what you are doing:

  1. Zeroing out the high frequencies causes ringing due to the Gibbs phenomenon.
  2. You are essentially multiplying the Fourier transform with a square function, which is equivalent to circularly convolving the time-domain data with the inverse transform of the square function, which is a sinc function. Unless you zero-pad the data before transforming it, the circular convolution will cause the data at the end of the FFT block to affect the data at the beginning, and vice versa.
  3. If you were doing multiple FFT's to process a stream of data, unless you use a technique like Overlap-Add or Overlap-Save, there will be discontinuities at the boundaries between FFT blocks. This problem is related to #2.
$\endgroup$
1
  • 1
    $\begingroup$ TL;DR: Use IIR. $\endgroup$
    – endolith
    Commented Jun 10, 2013 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.