How to implement a LowPass Filter?

后端 未结 3 527
余生分开走
余生分开走 2021-02-09 14:20

I\'m doing some math on both gyroscope and accelerometer data combined and I\'d like to low pass filter the resulting data. So could someone post some generic code for a Low Pas

3条回答
  •  走了就别回头了
    2021-02-09 15:06

    A low pass filter is simply smoothing of the results to remove the high frequencies. The simplest low pass filter is a box filter which is done by averaging n samples together.

    For averaging 2 samples together this is as simple as doing:

    sample[n] (sample[n] + sample[n + 1]) / 2;
    

提交回复
热议问题