弗朗索瓦 发表于 2016-7-28 15:15

怎么过滤噪声信号?

  想把一段采集的噪声信号1000Hz以上的频率过滤掉,要怎么过滤?

hcharlie 发表于 2016-7-28 16:56

低通滤波

william 发表于 2016-7-29 08:45

低通滤波C程序:1.
6.7.#include <stdio.h> 8.const int length = 180
9.void filter(int xin[ ],int xout[ ],int n,float h[ ]);
10.
11.static float h=
12.{0.01218354,-0.009012882,-0.02881839,-0.04743239,-0.04584568,
13.-0.008692503,0.06446265,0.1544655,0.2289794,0.257883,
14.0.2289794,0.1544655,0.06446265,-0.008692503,-0.04584568,
15.-0.04743239,-0.02881839,-0.009012882,0.01218354};
16.static int x1;
17.
18.void filter(int xin[ ],int xout[ ],int n,float h[ ])
19.{
20.int i,j;
21.float sum;
22.for(i=0;i<length;i++) x1=xin;
23.for (i=0;i<length;i++)
24.{
25.sum=0.0;
26.for(j=0;j<n;j++) sum+=h*x1;
27.xout=(int)sum;
28.}
29.for(i=0;i<(n-1);i++) x1=xin;
30.}
31.32.
33.void main( )
34.{
35.FILE *fp1,*fp2;
36.int frame,indata,outdata;
37.fp1=fopen(insp.dat,"rb");
38.fp2=fopen(outsp.dat,"wb");
39.40.frame=0;
41.while(feof(fp1)==0)
42.{
43.frame++;
44.printf("frame=%d\n",frame);
45.for(i=0;i<length;i++) indata=getw(fp1);
46.filter(indata,outdata,19,h);
47.for(i=0;i<length;i++) putw(outdata,fp2);
48.}
49.fcloseall( );
50.return(0);
51.}


页: [1]
查看完整版本: 怎么过滤噪声信号?