      SUBROUTINE FILDET(FILPER,FILRES,FREQ,RESMAX)    
C     
C     THIS SUBROUTINE FIRSTLY DETERMINES WHETHER A NON-ZERO RESPONSE    
C     CURVE EXISTS (I.E. WHETHER FILQ HAS BEEN CALLED OR NOT) AND IF    
C     SO, WHAT THE RESPONSE OF THE FILTER IS AT THE FREQUENCY WHICH     
C     IS IN FREQ.  THE INTERPOLATION IN THE FILRES ARRAY IS LINEAR
C     IN THE FREQUENCY. 
C     
      DIMENSION FILPER(1),FILRES(1) 
      DO 5 J=1,26 
        IF(FILPER(J).NE.0.0.OR.FILRES(J).NE.0.0)GO TO 10    
    5 CONTINUE    
C     
C     NO SENSIBLE RESPONSE SO RETURN
C     
      RETURN
C     
   10 CONTINUE    
C     
C     IDENTIFY THE FREQUENCIES THAT BRACKET FREQ AND THEN DO THE  
C     INTERPOLATION.  REMEMBER THAT FILPER CONTAINS PERIODS AND MUST BE 
C     INVERTED.   
C     
      DO 12 J=1,25
        IF(FREQ.GE.1./FILPER(J).AND.FREQ.LE.1.0/FILPER(J+1))GO TO 15    
   12 CONTINUE    
      STOP 'FILDET ERROR'     
   15 RESMAX=FILRES(J)+(FREQ-1.0/FILPER(J))*(FILRES(J+1)-FILRES(J))/    
     *                 (1.0/FILPER(J+1)-1.0/FILPER(J))
      RETURN
      END   
