From SPwang@EE.MsState.Edu Tue Dec 12 22:07:44 1995 Date: Tue, 12 Dec 1995 22:07:18 -0600 From: liang wang To: ychen@erc.msstate.edu Content-Length: 2098 Status: RO X-Lines: 106 ***************************************************************************** * This is a program to implement the Adaptive Line Enhancer algorithm ***************************************************************************** DIMENSION X(1024),F(70),Z(1024),D(1024) L=20 ITER=1024 ALFA=0.0000005 OPEN(UNIT=4, FILE='data15', TYPE='OLD') DO 10 I=1,ITER READ(4,*) T, X(I) 10 CONTINUE CLOSE(UNIT=4) DO 30 I=1,ITER D(I)=X(I+2) 30 CONTINUE CALL LMS(D,X,L,ALFA,ITER,F,E,Z) OPEN(UNIT=4, FILE='data15.2', TYPE='NEW') DO 40 I=1, ITER WRITE(4,*) Z(I) 40 CONTINUE STOP END * SUBROUTINE TO IMPLEMENT THE LMS ADAPTIVE FILTER SUBROUTINE LMS(D,X,L,ALFA,ITER,F,E,Z) REAL D(1024),X(1024),F(70),Z(1024) DO 5 K=1,40 5 F(K)=0.0 DO 50 N=1,ITER Y=0.0 DO 10 K=1,L IF(N-K.LT.0) THEN XX=0.0 ELSE XX=X(N-K+1) ENDIF 10 Y=Y+F(K)*XX E=D(N)-Y DO 20 K=1,L IF(N-K.LT.0) THEN XX=0.0 ELSE XX=X(N-K+1) ENDIF 20 F(K)=F(K)+ALFA*E*XX 50 CONTINUE DO 60 N=1,1024 Y=0.0 DO 70 K=1,L IF(N-K.LT.0) THEN XX=0.0 ELSE XX=X(N-K+1) ENDIF 70 Y=Y+F(K)*XX Z(N)=Y 60 CONTINUE RETURN END ********************************************************************** * This is a program to implement the autocorrelation algorithm ********************************************************************** DIMENSION X(1024),X1(1024), Y(1024) OPEN(UNIT=4, FILE='data15', TYPE='OLD') DO 10 I=1,1024 READ(4,*) t, X(I) 10 CONTINUE CLOSE(UNIT=4) TAO=4 ST=2 DO 60 I=TAO+1+ST+1, 1024 Y(I)=0.0 DO 30 J=I-ST, I+ST Y(I)=Y(I)+X(J)*X(J-TAO) 30 CONTINUE Y(I)=SQRT(ABS(Y(I)))/(2*ST+1) 60 CONTINUE OPEN(UNIT=16, FILE='out15.1') DO 40 I =TAO+1+ST, 1024 WRITE(16,*) Y(I) 40 CONTINUE STOP END