下面是我用的IIR的系数,是通过MATLAB得到的,是通过[B,A]=butter(4,[0.249594409,0.284906667])得到,
B =
1.0e-004 *
Columns 1 through 8
0.0410 0 -0.1639 0 0.2458 0 -0.1639 0
Column 9
0.0410
A =
Columns 1 through 8
1.0000 -5.9315 16.9555 -29.7829 34.9749 -28.0324 15.0209 -4.9459
Column 9
0.7848
然后转化成TI提供优化程序里所用的系数如下:
#define IIR_BPF_COEFFbp1 {\
-3688,5066,30,60,30,\
-3703,5323,231,462,231,\
-3918,5024,551,-1101,551,\
-3933,5649,10393,-20786,10393}
#define IIR_BPF_ISFbp1 244
#define IIR_BPF_NBIQbp1 4
#define IIR_BPF_QFMATbp1 12
对同一组数据进行滤波发现滤波后的结果差异很大,不知是什么原因造成的,下面是DSP滤波程序
void iirbp(float b[],float a[], float aa[],float u[],int N,unsigned int kk)
{
unsigned int temp_iIIR=0;
unsigned int temp_valueIIR=0;
int temp_iirin=0;
int temp_iirout=0;
temp_valueIIR=8192/(1<<kk);
aa[temp_iIIR]=aa[temp_iIIR];
for(temp_iIIR=0;temp_iIIR<temp_valueIIR;temp_iIIR++)
{
x.input=(aa[temp_iIIR]);
x.calc(&x);
INPUTB_TEMP[temp_iIIR]=(x.output<<1);
}
} |