设计IIR滤波器时的滤波器系数和采样率

时间:2016-04-03 13:59:32

标签: c++ filtering signal-processing digital-filter

现在我忘记了很久以前学到的那些过滤概念。

目前我正在设计IIR滤波器。 如果我将采样率设置为50个样本/秒,则过滤器效果很好。一旦我增加到100个样本/秒,滤波器输出信号就会失真。 可能是什么问题呢?我重新设计了越来越多的滤波器系数加倍。但情况更糟。

我实施了IIR Direct Form 2 transposed filtration,如下所示。

public void IIRDirectForm2TransposedFilteration(float x, float y, float z){

        out[0] = registerx[0] + Bcoefs[0] * x;
        out[1] = registery[0] + Bcoefs[0] * y;
        out[2] = registerz[0] + Bcoefs[0] * z;
        for(int i = 0; i < numcoefs-2; i++){
            registerx[i] = registerx[i+1] + Bcoefs[i+1] * x - Acoefs[i+1] * out[0];
            registery[i] = registery[i+1] + Bcoefs[i+1] * y - Acoefs[i+1] * out[1];
            registerz[i] = registerz[i+1] + Bcoefs[i+1] * z - Acoefs[i+1] * out[2];
        }
        registerx[numcoefs-2] = Bcoefs[numcoefs-1] * x - Acoefs[numcoefs-1] * out[0];
        registery[numcoefs-2] = Bcoefs[numcoefs-1] * y - Acoefs[numcoefs-1] * out[1];
        registerz[numcoefs-2] = Bcoefs[numcoefs-1] * z - Acoefs[numcoefs-1] * out[2];

}

0 个答案:

没有答案