欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4424|回復: 1
打印 上一主題 下一主題
收起左側

MATLAB聯合ccs做數字濾波器程序設計,適合純小白

[復制鏈接]
跳轉到指定樓層
樓主
之前學習的內容,因為沒有開發板,所以只能ccs聯合MATLAB一起做數字濾波器的設計。這個對于剛剛接觸的新手還是非常有難度的,像我就熬了一個通宵才做出來,當然還是有點菜。詳細的程序都在安裝包里。可以參考。而且ccs這個軟件有點迷,有時候沒有圖或者一些錯誤,可能重啟一下軟件就好了。


源程序如下:
  1. /*
  2. * main.c
  3. */

  4. #include "math.h"
  5. #include "stdio.h"
  6. #include <stdint.h>
  7. #include "stdlib.h"
  8. #include "string.h"
  9. #include "limits.h"
  10. //#include"fdacoefsiir900.h"
  11. //#include "fdacoefsiir600.h"
  12. //#include "fdacoefsiir50+900.h"
  13. //#include "fdacoefsiir50.h"
  14. #include "fdacoefs50001.h"

  15. #define length 2048
  16. #define pi 3.1415926

  17. long fs=10000;
  18. int f1=50;
  19. int f2=200;
  20. int f3=600;
  21. int f4=900;

  22. #define w1 2*pi*f1/fs
  23. #define w2 2*pi*f2/fs
  24. #define w3 2*pi*f3/fs
  25. #define w4 2*pi*f4/fs

  26. double input[length];
  27. double output[length];

  28. static double xlast[2];
  29. static double mlast[2];

  30. static double IIR_DR2(double x,double *plast,const double (*A)[3],const double (*B)[3])
  31. {
  32.         double tmp,last;

  33.         tmp = x*B[0][0];

  34.         last = tmp - (A[1][1]*plast[0] + A[1][2]*plast[1]);
  35.         tmp = last + (B[1][1] * plast[0] + B[1][2]*plast[1]);

  36.         plast[1] = plast[0];
  37.         plast[0] = last;

  38.         return tmp;
  39. }
  40. double IIR_Filter(double x)
  41. {
  42.         double mid,y;

  43.         mid = IIR_DR2(x,xlast,DEN,NUM);

  44.         y   = IIR_DR2(mid,mlast,&DEN[2],&NUM[2]);//二階濾波器組合成更高階數的濾波器

  45.         //更多階數...

  46.         return y;
  47. }
  48. void Init_Filter(void)//初始化中間數值
  49. {
  50.         xlast[0] = 0;
  51.         xlast[1] = 0;
  52.         mlast[0] = 0;
  53.         mlast[1] = 0;
  54. }

  55. int main(void)
  56. {
  57. unsigned int i,n;

  58. Init_Filter();

  59. for(i=0;i<length;i++)
  60. {

  61.         input[i]=2048*sin(w1*i)+2048*sin(w2*i)+2048*sin(w3*i)+2048*sin(w4*i);
  62. }


  63. for(n=0;n<length;n++)
  64. {
  65.         output[n]=IIR_Filter(input[n]);


  66. }


  67. for(;;);
  68. }

復制代碼

所有資料51hei提供下載:
7.zip (101.16 KB, 下載次數: 50)

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏3 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:943095 發表于 2023-9-19 10:35 | 只看該作者
你好加個好友交流一下可以嗎?
回復

使用道具 舉報

無效樓層,該帖已經被刪除
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表