I've been using a Butterworth high pass filter to correct the low frequency distortion of an acceleration waveform integrated to a velocity waveform. I throw out a small number of the first data points of the velocity waveform due to the filter settling time.

Is it acceptable or even possible to wrap the filter back around to the beginning and process those 'settling' points as well so I don't have to throw out any data?

Maybe you can reverse the direction of the filter when you hit your known settling point and process back to the beginning then reverse again and go all the way to the end?

I'm not sure if this is an obvious or appropriate question, I have no background in DSP.

  • $\begingroup$ you might want to look into zero-phase filtering instead. or just pad the beginning of the signal with zeros $\endgroup$ – endolith Oct 7 '15 at 13:47

If your input waveform is periodic, then wrap-around is appropriate. The most straightforward way to do this is: Initialize the filter state to correspond to an all-zeros input history. Start filtering from the beginning of the input data, writing the output to an output buffer (or in-place to the same buffer, but then the filter has to store its state internally). When the time index runs out of the data buffer, wrap it back to the beginning and keep inputting the filter with zeros for some time while adding the filter's output to successive samples of the output buffer.

You can continue this until the absolute values of the filter's state variables all go under some small threshold value decided by you. This gives an upper limit to residual error in the output. The state of a typical infinite impulse response (IIR) filter is equivalent to (or is directly) its n most recent output values, with n depending on the filter's order. You can keep count of how many of the most recent absolute output values were below the threshold, and when the count reaches n you are done. Or simply decide beforehand how long you will continue, as, for a particular filter, that will determine an upper limit to the residual error proportional to the input.

Note: the period of the input waveform should be an integer multiple of the sampling period.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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