切比雪夫低通滤波器程序
算法大致流程
int16_t IIR_Filter(double *a, int Lenth_a,
double *b, int Lenth_b,
int16_t Input_Data,
double *Memory_Buffer)
{
int Count=0;
double Output_Data = 0;
int Memory_Lenth = 0;
IF(Lenth_a >= Lenth_b) Memory_Lenth = Lenth_a;
else Memory_Lenth = Lenth_b;
Output_Data += (*a) * Input_Data; //a(0)*x(n)
for(Count = 1; Count < Lenth_a ;Count++)
{
Output_Data -= (*(a + Count)) *
(*(Memory_Buffer + (Memory_Lenth - 1) - Count));
}
//------------------------save data--------------------------//
*(Memory_Buffer +Memory_Lenth-1 ) = Output_Data;
Output_Data = 0;
//----------------------------------------------------------//
for(Count = 0; Count < Lenth_b ;Count++)
{
Output_Data += (*(b + Count)) *
(*(Memory_Buffer + (Memory_Lenth - 1) - Count));
}
//------------------------move data--------------------------//
for(Count = 0 ; Count < Memory_Lenth -1 ; Count++)
{
*(Memory_Buffer + Count) = *(Memory_Buffer + Count + 1);
}
*(Memory_Buffer + Memory_Lenth - 1) = 0;
//-----------------------------------------------------------//
return (int16_t)Output_Data;
}
切比雪夫参数计算器
硬件结构