Low pass signal filtering using FFT or simple infinite impulse response filter 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
There are three potential problems with what you are doing:


Zeroing out the high frequencies causes ringing due to the Gibbs phenomenon.
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.
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.