lp_filter_even.cpp

来自「c语言版各种fir滤波器的实现」· C++ 代码 · 共 29 行

CPP
29
字号
/**********************************************
* Filename : LP_filter_even.CPP               *
* Function : realization of LP FIR filter with*
             direct structure,n is even       *
*Parameter : (h) the coefficients of H(z)     *
			 (z) the inner state variables    *
			 (x) the input data               *
			 (y) the output data              *
			 (n) the number of h[]            *
			 (m) the number of input data     *
**********************************************/
void LP_filter_even(float h[],float z[],float x[],float y[],int n,int m)
{
	int i,j;
	for(i=0;i<m;i++)
	{
		y[i]=h[0]*(x[i]+z[n-2]);
		for(j=0;j<(n/2-1);j++)
		{
			y[i]=h[j+1]*(z[j]+z[n-j-3])+y[i];
		}
		for(j=(n-2);j>0;j--)
		{
			z[j]=z[j-1];
		}
		z[0]=x[i];
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?