# Digital filter for sharp impulse in data

I am looking for an algorithm or a filter to remove sharp peaks from my data. I am collecting raw data after every 1 second from an sensor through an ADC. The ADC has an internal FIR filter. I use this filter to remove the 50-Hz noise. So, if there is huge disturbance or jerk to the sensor, it gives out sharp values. I want to filter out these sharp values. Also, I want the raw values to be sensitive to small changes but avoid a sharp jump in the value. Why do I want to remove these sharp peaks or impulses from the raw data? - Because it disturbs the Kalman filter ;- the Kalman filter estimates position and velocity. I am interested in velocity values of my Kalman filter. These values try to follow the sharp peak either up or down. Hence, velocity output is affected and then needs few more samples to determine a proper actual value.

• "1-sec" is not a rate. Do you mean $1\,\text s^{-1}=1\,\text{Hz}$? Anyway, you're not really describing anything about the system you're observing – does that include the abrupt change or not? That makes a huge difference: If the system is expected to do jumps, then you're just not sampling fast enough, if it's not, then the jump is noise and can just be filtered out. – Marcus Müller Jul 29 '17 at 8:38
• @MarcusMüller Thanks for the feedback. I have updated my Question ....added few more details.what kind of filter or algorithm can I use here? – nema Jul 31 '17 at 2:40
• You could use a simple threshold. This isn't really filtering (or at least not linear one) but it's a good way of discarding unuseful data. You could buffer the previous value and only take the new one in account if it's less than $x\%$ of the previous value. – Florent Jul 31 '17 at 3:29