www.pudn.com > notchfilter1.rar > notchfilter1.c


/*--------------------------------------------------------- 
 
	Notch Filter: 
	B:			input data(complex, frequency domain) 
	len_B:		complex data length 
 
  	Copyrights Innofidei, Inc. Beijing. All rights reserved. 
	Version 0.1 
 
	Confidential, do not release this program package to anyone without permission. 
	Current responsible engineer: Shen Yebing. 
	Supervisor of the responsible engineer: Kang Liangchuan. 
	When this file is modified, inform Kang Liangchuan, Shao Zhihui, Zhang Yubing, Shen Yebing.	 
	Revision history: 
	2007-07-20	Created by Kang Liangchuan. 
---------------------------------------------------------*/ 
 
#include  
#include  
#include  
#include  
#include  
 
void notchfilter1(double *B,int len_B,double pnotch) 
{ 
	int i,j; 
	double Esav=0; 
	double Gnotch; 
	double Etemp=0; 
	double Emax=0; 
	static double *A1; 
 
	static int counter; 
	A1=(double *)calloc(len_B*8,sizeof(double)); 
    
	//double pnotch = 4.0; 
 
	for(i=0; i6.0) 
	 { Gnotch =sqrt(Esav/counter)*4.0; 
	  
	 } 
     /*else if(sqrt(Emax/Esav)>7) 
	 { Gnotch =sqrt(Esav/counter)*7; 
	  
	 } 
	   else if(sqrt(Emax/Esav)>6) 
	 { Gnotch =sqrt(Esav/counter)*6; 
	  
	 }*/ 
   
	else 
	 Gnotch =sqrt(Esav/counter)*1000000.0; 
	} 
	else 
	{ 
		counter=0; 
		if(sqrt(Emax/Esav)>6.0) 
	 { Gnotch =sqrt(Esav/4)*4.0; 
	  
	 } 
    /* else if(sqrt(Emax/Esav)>7) 
	 { Gnotch =sqrt(Esav/4)*7; 
	  
	 } 
	 else if(sqrt(Emax/Esav)>6) 
	 { Gnotch =sqrt(Esav/4)*6; 
	  
	 }*/ 
   
	else 
	 Gnotch =sqrt(Esav/4)*1000000.0; 
	} 
 
	for (i=0; i Gnotch) 
		{   
	        B[2*i] =0; 
			B[2*i+1] =0;	 
		 
			 
		} 
	 
	} 
}