📄 latc_filter.cpp
字号:
/**********************************************
* Filename : Latc_filter.CPP *
* Function : realization of FIR filter with *
Lattice structure *
*Parameter : (k) the coefficients of Lattice *
filter *
(q) the inner state variables *
(x) the input data *
(y) the output data *
(n) the number of k[] *
(m) the number of input data *
**********************************************/
#include <stdlib.h>
void latc_filter(float k[],float q[],float x[],float y[],int n,int m)
{
int i,j;
float *p;
p=(float *)calloc(n,sizeof(float));
for(i=0;i<m;i++)
{
*p=x[i]*k[0];
for(j=1;j<n;j++)
{
*(p+j)=*(p+j-1)+q[j-1]*k[j];
}
for(j=n-1;j>0;j--)
{
q[j]=*(p+j-1)*k[j]+q[j-1];
}
q[0]=x[i]*k[0];
y[i]=*(p+n-1);
}
free(p);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -