sunchanghao 发表于 2007-8-1 20:07:03

求助关于FIR软件滤波

我用PCI5102卡采集到的信号,采样率为10MS/s,希望能够将50Hz的工频电信号滤掉,从别人那里拷来的滤波程序,但对其中的参数设置没搞懂,向大侠们请教,程序如下:
void FIRFilter(double *input, double *output)
{
char errorflag=0;
intstatus, firtype=1, firtaps=501, daqrecordlength;
double firfl, firfh, *temp, *FIRCoeffs;
    daqrecordlength=(int)(setsamprate/setvolfrequency);
    temp = malloc(sizeof(double)*(daqrecordlength+firtaps));
    FIRCoeffs = malloc(firtaps*sizeof(double));
    firfl=50.0;
    firfh=setsamprate/2;
    Clear1D(FIRCoeffs,firtaps);
    status = FIR_Coef (firtype, setsamprate, firfl, firfh, firtaps, FIRCoeffs);
    if (status != NoAnlysErr)
    {
   MessagePopup("      错误", "FIR滤波参数设置有误!");
   errorflag = 1;
    }
    if (errorflag!=1)
    {
       Clear1D(temp,daqrecordlength+firtaps);               
       Convolve (input, daqrecordlength, FIRCoeffs, firtaps, temp);
       Copy1D (temp, daqrecordlength, output);
    }
    free(FIRCoeffs);
    free(temp);
}

问题1:参数firtaps的值应设置为多少合适?改变firtaps的值会影响那些东西?
问题2:若要滤掉50Hz以下的信号,为什么firfl设置到5000以上才见到效果?
问题3:不论是低通方式还是高通方式,改变firfh的值似乎并不影响滤波效果,是这样吗?
页: [1]
查看完整版本: 求助关于FIR软件滤波