简体   繁体   中英

low pass filter on ongoing samples

My application requires to sample a sensor and send the samples out in real time, without saving the samples.

I am required to run a low pass filter on the samples, but here is the problem cause if I want to do it on 20 samples for example then I will not be able to send out the samples each after I got it as required, and when I send them immediately each after I got it I use an ongoing average on 10 samples but that wasn't enough.

what low pass filter algorithm is the best for this application?

what is the accepted way to do this?

Try the Exponential, or First-order filter:

Y[n] = dY[n-1] + (1-d)X[n]

  • Y[n] is the current output
  • Y[n-1] is the previous output
  • X[n] is the current input
  • d is the damping factor

The damping factor is a number between 0 and 1. If d = 0, the output is just equal to the input, and no filtering (smoothing) takes place. The closer d is to 1, the greater the amount of filtering (smoothing).

Here is an example: The input signal is a Sine function with amplitude +- 100, added to that is random noise of +-10. To filter out the noise we run the data through the filter equation first with d = 0.5 and then d = 0.8在此处输入图像描述

More details with code and second and third order filters available here >> ST Community- answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM