您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 限速滤波的C语言实现
/**文件名:Filter.c*功能描述:限速滤波*/#includemath.h#defineucharunsignedchar//保存滤波后Y2,Y3的值ucharg_result[2];//函数原型申明voidFilter(ucharY1,ucharY2,ucharY3);/**函数名:main*功能描述:main主程序*输入参数:无*返回值:无*/voidmain(void){Filter(10,20,30);//对采样值10,20,30滤波while(1);}/**函数名:Filter*功能键描述:限速滤波*输入参数:Y1:第一次采样值;Y2:第二次采样值;Y3:第三次采样值*返回值:无*/voidFilter(ucharY1,ucharY2,ucharY3){uchartemp1,temp2,temp3;temp1=abs(Y2-Y1);temp2=abs(Y3-Y2);temp3=(temp1+temp2)/2;if(temp1=temp3){g_result[0]=Y2;}elseif(temp2=temp3){g_result[1]=Y3;}else{g_result[1]=(Y2+Y3)/2;}}
本文标题:限速滤波的C语言实现
链接地址:https://www.777doc.com/doc-4474629 .html