![c語言寫的fir低通濾波器_第1頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/21/c69d9ad3-b32a-498b-922e-1f466b69e201/c69d9ad3-b32a-498b-922e-1f466b69e2011.gif)
![c語言寫的fir低通濾波器_第2頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/21/c69d9ad3-b32a-498b-922e-1f466b69e201/c69d9ad3-b32a-498b-922e-1f466b69e2012.gif)
![c語言寫的fir低通濾波器_第3頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/21/c69d9ad3-b32a-498b-922e-1f466b69e201/c69d9ad3-b32a-498b-922e-1f466b69e2013.gif)
![c語言寫的fir低通濾波器_第4頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/21/c69d9ad3-b32a-498b-922e-1f466b69e201/c69d9ad3-b32a-498b-922e-1f466b69e2014.gif)
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、根據(jù) fir 濾波器的公式 y(n)= Eh(m)x(nm);(m: 0 (N-1).利用 MATLAB 產(chǎn)生濾波器系 數(shù)(h (n)并歸一化,下面為一個 LP 濾波算擊 void filter( void) uint16 i,j; fp32 sum; int16 x12030; fp32 h19= -0.0027, -0.0025, 0.0050, 0.0157, -0.0000, -0.0471, -0.0482, 0.0838, 0.2953, 0.4013, 0.2953, 0.0838, -0.0482, -0.0471, -0.0000,0.0157, 0.0050, -0.002
2、5, -0.0027; for(i=0;i2020;i+) x1i = data0i; for(i=0;i2020;i+) sum=0.0; for(j=0;j= j) sum+=hj*x1i-j; else ; data0i=(int16)sum; for(i=0;i2000;i+) data0i = data0i+20; 考慮到前 19個點為不完全累加和,故拋去前 19個點。(應(yīng)該是前后各 18個點都是 不完全累加和,都應(yīng)該去掉,對于數(shù)據(jù)分段進入濾波器的情況,應(yīng)該把前一段的后 面數(shù)據(jù)放到下一段的前面,這段時間我在解調(diào) FSK 時遇到了這個問題,通過濾波器 的數(shù)據(jù)的分段處理。) 設(shè)輸入數(shù)據(jù)x
3、N,輸出數(shù)據(jù)yN,濾波器系數(shù)hn 1.直接法(由y(m)=h(0)*x(m)+h(1)*x(m-1)+.+h(N-1)*x(m-n-1); void fir(short x, short h, short y) int i,j; long long sum; for (j = 0; j N; j+) sum = 0; for (i = 0; i 15; 乘法器使用次數(shù):N*n 2逆推法: void fir(short x, short h, short y) int i,j; long sum; for (j = 0; j n; j+) for (i = 0; i 15; ) ) ) 乘法器使
4、用次數(shù):N*n 3.倒序法:(輸入輸出可以是同一量) void fir(short x, short h口,short y) ( int i,j; long long sum; for (j = N; j 0; j-) ( sum = 0; for (i = n; i 0; i-) sum += xj-i * hi; yj = sum 15; ) )#include #include #define true 1 #define false 0 #define n 8 #define bufsize 100 /* the buffer size is 100 */ /* global decl
5、arations */ int in_bufferbufsize; /* processing data buffers */ int out_bufferbufsize; /* functions */ static int processing *input, int *output); static void dataio(void); static long round(long a); void main() int *input = &in_buffer0; int *output = &out_buffer0; puts(the 1st experiment st
6、artedn); /* loop forever */ while (true) /* * read input data using a probe-point connected to a host file. * write output data to a graph connected through a probe-point. */ / read the input signal. / if the input file is sine1.dat, the signal contains 300hz,400hz and 500hz. / if the input file is
7、sine2.dat, the signal contains 100hz,400hz and 500hz. / the sampling frequency is 1200hz. dataio(); /* remove the frequency compoment of 400hz and 500hz*/ processing(input, output); / write the output signal. / the output file is result.dat. dataio(); /* * = processing = * * function: apply a low-pa
8、ss fir filter to input signal and remove the frequency higher than 350hz. * * parameters: address of input and output buffers. * * return value: true. */ static int processing *input, int *output) int i,size = bufsize; short xx0,x,y; / short zn=0,0,0,0,0,0,0,0,0; short zn=0,0,0,0,0,0,0,0; /short w2*
9、n+1=22,356,155,990,466,220,777,216,777,26,466,9,155,0,22; /short w2*n+1=6,457,56,1024,224,418,523,382,784,99,784,43,523; / short w2*n+1=330*2,3299*2,1982*2,6867*2,4955*2,1594*2,6607*2,1065*2,4955*2,109*2,1982*2,17*2,330*2; /short w2*n+1=661,6598,3964,13733,9910,3187,13214,2131,9910,217,3964,34,661;
10、/ short w2*n+1=58,5628,526,8192,2105,5883,4913,3829,7369,1543,7369,504,4913,102,2105,14,526,1,58; /short w2*n+1=28,4432,280,8192,1259,4883,3356,3975,5873,1509,7048,644,5873,142,3356,30,1259,3,280,0,28; / short w2*n+1=26,651,182,1024,545,421,909,247,909,51,545,11,182,1,26; /short w2*n+1=831,20846,581
11、5,32768,17445,13486,29075,7888,29075,1647,17445,349,5815,21,831; /short w2*n+1=208,5211,1454,8192,4361,3371,7269,1972,7269,412,4361,87,1454,5,208; short w2*n+1=101,4356,810,8192,2835,3403,5670,2517,7088,605,5670,193,2835,21,810; / short w2*n+1=101,4356,810,8192,2835,3403,5670,2517,7088,605,5670,193,
12、2835,21,810,2,101; / short w2*n+1=50,3814,454,8192,1815,3504,4235*,3084,6353,831,6353,349,4235,50,1815,8,454,0,50; long y0,z0;/22222222222222 while (size-) xx0=*input+; x=xx0*6; z0=(long)x15; y0=0; for(i=0;i15); y0=round(y0); for(i=n-1;i0;i-) zi=zi-1; z0=round(z0); z0=(short)(z015); y=(short)(y015); *output+ =y; /* additional processing load */ return(true); /* * = dataio = * * function: read input signal and w
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年商場會員積分兌換機器人企業(yè)制定與實施新質(zhì)生產(chǎn)力戰(zhàn)略研究報告
- 2025-2030年商用真空油炸機企業(yè)制定與實施新質(zhì)生產(chǎn)力戰(zhàn)略研究報告
- 2025-2030年復(fù)古鐵藝臺燈企業(yè)制定與實施新質(zhì)生產(chǎn)力戰(zhàn)略研究報告
- 2025-2030年戶外網(wǎng)球場行業(yè)跨境出海戰(zhàn)略研究報告
- 2025-2030年微波透熱深層按摩儀行業(yè)跨境出海戰(zhàn)略研究報告
- 2025-2030年手機音樂播放器企業(yè)制定與實施新質(zhì)生產(chǎn)力戰(zhàn)略研究報告
- 室內(nèi)游藝器材市場調(diào)研與預(yù)測考核試卷
- 五金產(chǎn)品設(shè)計與品牌建設(shè)關(guān)聯(lián)性研究考核試卷
- 建筑材批發(fā)商競爭力分析考核試卷
- 愛國衛(wèi)生工作先進個人事跡(6篇)
- 2025年營口職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 藥膳與食療理論試題答案
- 七年級歷史下冊第2課唐朝建立與貞觀之治
- 8.3+區(qū)域性國際組織+課件高中政治統(tǒng)編版選擇性必修一當(dāng)代國際政治與經(jīng)濟
- 2025年國網(wǎng)陜西省電力限公司高校畢業(yè)生招聘1100人(第二批)高頻重點提升(共500題)附帶答案詳解
- 《深度學(xué)習(xí)的7種有力策略》
- 遼寧中醫(yī)藥大學(xué)附屬醫(yī)院社會招聘真題
- 2025年潞安化工集團招聘筆試參考題庫含答案解析
- 幼兒園一日生活安全課件
- 《認(rèn)罪認(rèn)罰案件被追訴人反悔應(yīng)對機制研究》
- 多旋翼無人飛行器嵌入式飛控開發(fā)實戰(zhàn)-基于STM32系列微控制器的代碼實現(xiàn)
評論
0/150
提交評論