翻译c语言写的fir滤波器_第1页
翻译c语言写的fir滤波器_第2页
翻译c语言写的fir滤波器_第3页
翻译c语言写的fir滤波器_第4页
翻译c语言写的fir滤波器_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、翻译c语言写的fir滤波器请会的帮我把没行的注释写上。谢谢#include #include #definetrue1#definefalse0#definen8#definebufsize100/*thebuffersizeis100*/*globaldeclarations*/intin_bufferbufsize;/*processingdatabuffers*/intout_bufferbufsize;/*functions*/staticintprocessing(int*input,int*output;staticvoiddataio(void;staticlonground(l

2、onga;voidmain(int*input=&in_buffer0;int*output=&out_buffer0;puts(the1stexperimentstartedn;/*loopforever*/while(true/*readinputdatausingaprobe-pointconnectedtoahostfile.*writeoutputdatatoagraphconnectedthroughaprobe-point.*/readtheinputsignal./iftheinputfileissine1.dat,thesignalcontains300hz,400hzand

3、500hz./iftheinputfileissine2.dat,thesignalcontains100hz,400hzand500hz./thesamplingfrequencyis1200hz.dataio(;/*removethefrequencycompomentof400hzand500hz*/ processing(input,output; /writetheoutputsignal. /theoutputfileisresult.dat. dataio(;/*=processing=*function:applyalow-passfirfiltertoinputsignala

4、ndremovethefrequencyhigherthan350hz.*parameters:addressofinputandoutputbuffers.*returnvalue:true.*/staticintprocessing(int*input,int*outputinti,size=bufsize;shortxx0,x,y;/shortzn=0,0,0,0,0,0,0,0,0;shortzn=0,0,0,0,0,0,0,0;/shortw2*n+1=22,356,155,990,466,220,777,216,777,26,466,9,155,0,22;/shortw2*n+1=

5、6,457,56,1024,224,418,523,382,784,99,784,43,523;/shortw2*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;/shortw2*n+1=661,6598,3964,13733,9910,3187,13214,2131,9910,217,3964,34,661;/shortw2*n+1=58,5628,526,8192,2105,5883,4913,3829,7369,1543,7369,504,4913,102,

6、2105,14,526,1,58;/shortw2*n+1=28,4432,280,8192,1259,4883,3356,3975,5873,1509,7048,644,5873,142,3356,30,1259,3,280,0,28;/shortw2*n+1=26,651,182,1024,545,421,909,247,909,51,545,11,182,1,26;/shortw2*n+1=831,20846,5815,32768,17445,13486,29075,7888,29075,1647,17445,349,5815,21,831;/shortw2*n+1=208,5211,1

7、454,8192,4361,3371,7269,1972,7269,412,4361,87,1454,5,208;shortw2*n+1=101,4356,810,8192,2835,3403,5670,2517,7088,605,5670,193,2835,21,810;/shortw2*n+1=101,4356,810,8192,2835,3403,5670,2517,7088,605,5670,193,2835,21,810,2,101;/shortw2*n+1=50,3814,454,8192,1815,3504,4235*,3084,6353,831,6353,349,4235,50

8、,1815,8,454,0,50;longy0,z0;/22222222222222while(size-xx0=*input+;x=xx0*6;z0=(longx15; y0=round(y0; for(i=n-1;i0;i- zi=zi-1; z0=round(z0; z0=(short(z015; y=(short(y015; *output+=y; /*additionalprocessingload*/ return(true; /* *=dataio= * *function:readinputsignalandwriteprocessedoutputsignal. * *parameters:no

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论