I am trying to implement a low pass filter in Java. My requirement is very simple,I have to eliminate signals beyond a particular frequency (Single dimension). Looks like Butterworth filter would suit my need.
Now the important thing is that CPU time should be as low as possible. There would be close to a million sample the filter would have to process and our users don't like waiting too long. Are there any readymade implementation of Butterworth filters which has optimal algorithms for filtering.
Explanation: Lowpass filters are considered of three types: Ideal, Butterworth, and Gaussian.
The filter fibres have to allow sufficient air to pass through – without offering too much resistance – while also trapping harmful particles. This is the strength of good filters. A human being inhales and exhales some twenty kilograms of air daily.
I have a page describing a very simple, very low-CPU low-pass filter that is also able to be framerate-independent. I use it for smoothing out user input and also for graphing frame rates often.
http://phrogz.net/js/framerate-independent-low-pass-filter.html
In short, in your update loop:
// If you have a fixed frame rate smoothedValue += (newValue - smoothedValue) / smoothing // If you have a varying frame rate smoothedValue += timeSinceLastUpdate * (newValue - smoothedValue) / smoothing
A smoothing
value of 1
causes no smoothing to occur, while higher values increasingly smooth out the result.
The page has a couple of functions written in JavaScript, but the formula is language agnostic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With