1
;; Estimate the total work (ntaps * sampling rate) for two cascaded
2
;; decimating low pass filters.
4
;; The basic assumption is that the number of taps required in any
5
;; section is inversely proportional to the normalized transition width
8
;; FS is the input sampling frequency
9
;; F1 is the cutoff frequency
10
;; F2 is the far edge of the transition band
11
;; DEC1 is the decimation factor for the first filter
12
;; DEC2 is the decimation factor for the 2nd filter
14
;; The total decimation factor is DEC1 * DEC2. Therefore,
15
;; the output rate of the filter is FS / (DEC1 * DEC2)
17
(require 'common-list-functions)
22
(define (work2 fs f1 f2 dec1 dec2)
23
(+ (work1 fs f1 (/ fs (* 2 dec1)) dec1)
24
(work1 (/ fs dec1) f1 f2 dec2)))
27
;; work for a single section
29
(define (work1 fs f1 f2 dec)
30
(/ (* fs (/ fs (- f2 f1))) dec))
33
;; return the max integer dec such that fs/(2*dec) >= f2
35
(define (max-dec fs f2)
36
(inexact->exact (floor (/ fs (* 2 f2)))))
39
;; `adjoin' returns the adjoint of the element OBJ and the list LST.
40
;; That is, if OBJ is in LST, `adjoin' returns LST, otherwise, it returns
43
(define (adjoin-equal obj lst)
44
(if (member obj lst) lst (cons obj lst)))
51
(define (aux set head)
53
(set! result (cons head result))
55
(aux (set-difference set (list x))
61
;; `extract-nth' returns the Nth element of LST consed on to the
62
;; list resulting from splicing out the Nth element of LST.
63
;; Indexing is 0 based.
65
(define (extract-nth n lst)
b'\\ No newline at end of file'