请大家看看我的FIR滤波问题出在哪边?

[复制链接]
 楼主| caopeng32 发表于 2010-9-6 16:54 | 显示全部楼层 |阅读模式
我的FIR滤波的代码
#define M 16 /*number of coefficients*/
#define N 16 /*number of output samples*/
COEFS fir_coefs;/*coefficients structure*/
int a[N];/*filter output vector*/
int x0[N];
short x[M+N-1];/*filter input vector*/
short h[M]={3099,   1137,   1305,   1456,   1586,   1687,   1758,   1795,   1795,
     1758,   1687,   1586,   1456,   1305,   1137,   3099};/*filter coefficients vector*/
uint16_t xyz_FIR[16];
void FIR_filter(u32 k)
{
  u8 j;
  for (j=0;j<16;j++)
   {
     x0[j] = ADCConvertedValue[j]+offsetx;
  x[j+16]= x0[j];
   }
   if (k>1) //第一次的16个数据无法完成FIR滤波
   {
       fir_coefs.nh = M; /*Number of Coefficients for FIR*/
       fir_coefs.h = h; /*Pointer on FIR coefficient vector*/
       fir_16by16_stm32(a,x,&fir_coefs,N);/*performs the FIR filtering*/
    }
   for(j=0;j<15;j++)
   {
     x[j]= x0[j+1];
   }
   if (k>1)  //第一次的16个数据无法完成FIR滤波
   {
    for (j=0;j<16;j++)
    {  
      xyz_FIR[j]=a[j]/65535;
    }
   }  
}
在没有滤波时采集的数据

没有滤波时采集的数据

没有滤波时采集的数据

使用滤波后采集的数据

加入FIR滤波后采集的数据

加入FIR滤波后采集的数据
 楼主| caopeng32 发表于 2010-9-6 19:06 | 显示全部楼层
怎么木有人呢?
 楼主| caopeng32 发表于 2010-9-7 11:03 | 显示全部楼层
为啥还是木有人?
 楼主| caopeng32 发表于 2010-9-8 20:36 | 显示全部楼层
依然木有人
selina1983 发表于 2010-10-29 13:49 | 显示全部楼层
不懂啊   还在研究啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

12

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部