www.pudn.com > DSP6711filter.rar > main.c
//IIR 19阶butterworth低通滤波器 //采样频率fs=40k,截止频率fc=10k //吴臻志作于2006/12/8 #include#include "math.h" #define N 20 #define Length 128 float input[Length],output[Length]; const float b[N] = { 1.532234455e-005,0.0002911245683, 0.002620120998, 0.01484735217, 0.05938940868, 0.1781682223, 0.415725857, 0.7720623016, 1.158093452, 1.415447593, 1.415447593, 1.158093452, 0.7720623016, 0.415725857, 0.1781682223, 0.05938940868, 0.01484735217, 0.002620120998,0.0002911245683, 1.532234455e-005 }; const float a[N] = { 1,-1.341377151e-015, 2.582051277,-3.020413399e-015, 2.629014969, -2.643519736e-015, 1.364365935,-1.157850946e-015, 0.3901539147,-2.727497971e-016, 0.06217307225,-3.461429587e-017, 0.005333174486,-2.247626948e-018,0.0002255303698, -6.607450878e-020,3.915039997e-006,-6.698137419e-022,1.784284365e-008,-9.904767921e-025 }; void filter(){ int n,j; float temp; float x[N],y[N]; //采样频率fs=40k,截止频率fc=10k for (j=0;j 0;j--){ x[j]=x[j-1]; y[j]=y[j-1]; } } while(1); } void test1(){ int n; for (n=0;n