查看: 1398|回复: 0

[经验] DSP28 fir低通滤波器的设计源码

[复制链接]

该用户从未签到

发表于 2021-3-6 21:14:50 | 显示全部楼层 |阅读模式
分享到:
  1. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"stdio.h"</span>
  2. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"math.h"</span>
  3. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#include"DSP28_Device.h"</span>
  4. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#defineorder 26</span>
  5. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#defineN  128         </span>
  6. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definepi 3.1415926</span>
  7. <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>
  8. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">floats;</span>
  9. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">inti,n;</span>
  10. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">floatinput[N],output[N];  </span>
  11. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intfs=10000;   </span>
  12. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intf1=600;   </span>
  13. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">intf2=1500;</span>
  14. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definefa 2*pi*f1/fs</span>
  15. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">#definefb 2*pi*f2/fs</span>
  16. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">void inputwave()</span>
  17. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">{</span>
  18. <span style="color: rgb(51, 51, 51); font-family: " microsoft="" yahei";"="">    for(n=0;n</span><n;n++ )
  19. input[n]=sin(fa*n)+sin(fb*n);
  20. }
  21. voidmain()
  22. {   int m=0,n=0;
  23.     inputwave();           
  24. for(n=0;n<n+order;n++)
  25. {
  26.   for(s=0,m=0;(m<order)&&(m<n);m++)
  27. {
  28.    s=FIR_LPF[m]*input[n-m]+s;
  29. }
  30.         output[n]=s;}
  31. while(1);  </order)&&(m<n);m++)
  32. </n+order;n++)
  33. </n;n++>
复制代码
DSP28 fir低通滤波器的设计源码
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /2 下一条



手机版|小黑屋|与非网

GMT+8, 2024-4-18 21:12 , Processed in 0.109930 second(s), 15 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.