I haven't got any experience myself, but it look likes what you need
Or you could just write something like this:
int difference = reading - lastreading;
abs(difference);
if(difference > 10) reading = lastreading;
It will ignore the data if you for example shake the sensor.
The best solution might be combining those two approaches.
- Lauszus