一阶低通滤波

软件层面的滤波

 1 /*
 2  @brief: 一阶低通滤波算法,  Yn = (1-a)Yn-1 + aXn;
 3              y = A * y_1 + C * x_1; 其中y_1是上次滤波值,x是本次采样值
 4  @para: last_filter:上次滤波值
 5         last_sample:上次采样值
 6         new_sample:本次采样值
 7  @return: 新的滤波值
 8  
 9 */
10 unsigned int One_Order_LPF(unsigned int last_filter,unsigned int new_sample) 
11 {
12     unsigned int result = 0;
13     unsigned long long temp = (last_filter * 35 + new_sample * 65) / 100;
14     result = (unsigned int)temp;
16     return result;
17 }

 

posted @ 2024-02-27 08:55  njit-sam  阅读(61)  评论(0编辑  收藏  举报