10种简单的数字滤波算法(C语言源程序)

[09-11 23:02:06]   来源:http://www.88dzw.com  单片机学习   阅读:8253

文章摘要: { temp = value_buf[i]; value_buf[i] = value_buf[i+1]; value_buf[i+1] = temp; } } } for(count=1;count<N-1;count++) sum += value[count]; return (char)(sum/(N-2)); } 6、限幅平均滤波法 /* */ 略 参考子程序1、3 7、一

10种简单的数字滤波算法(C语言源程序),标签:单片机开发,单片机原理,单片机教程,http://www.88dzw.com
         {
            temp = value_buf[i];
            value_buf[i] = value_buf[i+1]; 
             value_buf[i+1] = temp;
         }
      }
   }
   for(count=1;count<N-1;count++)
      sum += value[count];
   return (char)(sum/(N-2));
}
6、限幅平均滤波法
/*
*/  
略 参考子程序1、3
7、一阶滞后滤波法
/* 为加快程序处理速度假定基数为100,a=0~100 */
#define a 50
char value;
char filter()
{
   char  new_value;
   new_value = get_ad();
   return (100-a)*value + a*new_value; 
}
8、加权递推平均滤波法
/* coe数组为加权系数表,存在程序存储区。*/
#define N 12
char code coe[N] = {1,2,3,4,5,6,7,8,9,10,11,12};
char code sum_coe = 1+2+3+4+5+6+7+8+9+10+11+12;
char filter()
{
   char count;
   char value_buf[N];
   int  sum=0;
   for (count=0,count<N;count++)
   {
      value_buf[count] = get_ad();
      delay();
   }
   for (count=0,count<N;count++)
      sum += value_buf[count]*coe[count];
   return (char)(sum/sum_coe);
}
9、消抖滤波法
#define N 12
char filter()
{
   char count=0;
   char new_value;
   new_value = get_ad();
   while (value !=new_value);
   {
      count++;
      if (count>=N)   return new_value;
       delay();
      new_value = get_ad();
   }
   return value;    
}
10、限幅消抖滤波法
/*
*/
略 参考子程序1、9

上一页  [1] [2] 


Tag:单片机学习单片机开发,单片机原理,单片机教程单片机学习

《10种简单的数字滤波算法(C语言源程序)》相关文章

分类导航
最新更新
热门排行