        complex function filter(freq,fpar,nfil)
c filter routine for phoenix bc87 data
c adapted for metronix(MM) 
        logical compare
        dimension fpar(*),freq1(26),rl(26),aim(26)
        filter=1.
	pi = 3.14159265358979323846264338327950
	factor = 1e0 / ( 4e0 * pi * 1e-7 )
        write(*,*)'I am in a filter routine'
        k=1
        do 5 i=1,nfil,3
          freq1(k)=fpar(i)
          rl(k)=fpar(i+1)*cos(fpar(i+2))
          write(*,*)rl(k)
          aim(k)=fpar(i+1)*sin(fpar(i+2))
    5     k=k+1
        do 10 i=1,k-1
          if(compare(freq1(i),freq,4))then
            filter=cmplx(rl(i),aim(i)) * factor
            return
          endif
   10     continue
        return
        end
