|
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"stdio.h"</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"math.h"</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"DSP28_Device.h"</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#defineorder 26</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#defineN 128 </span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definepi 3.1415926</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">floatFIR_LPF[order] ={-1.52864422149721e-05,-0.000133359311426970,-0.000544636220343477,-0.00137835208978255,-0.00218948983490142,-0.00124340086554490,0.00478134865608317,0.0198838342801837,0.0464361812966399,0.0825102845162328,0.120763491355644,0.150360916315540,0.161536936687780,0.150360916315540,0.120763491355644,0.0825102845162328,0.0464361812966399,0.0198838342801837,0.00478134865608317,-0.00124340086554490,-0.00218948983490142,-0.00137835208978255,-0.000544636220343477,-0.000133359311426970,-1.52864422149721e-05};</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">floats;</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">inti,n;</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">floatinput[N],output[N]; </span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intfs=10000; </span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intf1=600; </span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intf2=1500;</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definefa 2*pi*f1/fs</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definefb 2*pi*f2/fs</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">void inputwave()</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">{</span>
- <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"=""> for(n=0;n</span><n;n++ )
- input[n]=sin(fa*n)+sin(fb*n);
- }
- voidmain()
- { int m=0,n=0;
- inputwave();
- for(n=0;n<n+order;n++)
- {
- for(s=0,m=0;(m<order)&&(m<n);m++)
- {
- s=FIR_LPF[m]*input[n-m]+s;
- }
- output[n]=s;}
- while(1); </order)&&(m<n);m++)
- </n+order;n++)
- </n;n++>
复制代码 DSP28 fir低通滤波器的设计源码
|
|