;; In this example, we design a differentiator. In the ``passband,''
;; the frequency response is proportional to the frequency. To design
;; this filter, you will learn how to use the powerful LAMBDA
;; construct provided by Scheme.
(title "A simple filter IV")
(verbose #t)
;; sine symmetry is required for differentiators
(sine-symmetry)
(filter-length 20)
(sampling-frequency 60)
;; define 2pi = 8 * atan 1 = 6.2831...
(define 2pi (* 8 (atan 1)))
;; The passband. Previously, we constrained H(f) to be *constant* in
;; a certain band. We now constrain the frequency response to be
;; equal to a certain *function* of the frequency.
;; In particular, we want H(f) = 2 pi f .
(limit-= (band 0 10) (lambda (f) (* 2pi f)))
;; In Scheme, the syntax `(lambda (VARIABLE) )' creates a function of VARIABLE. (lambda (f) f) is the
;; identity function, which equals F for all frequencies F.
;; The stopband is identically zero. We use the lambda notation to
;; show another example of a function.
(limit-= (band 20 30) (lambda (f) 0))
;; Incidentally, the weight can itself be a function of the
;; frequency.
(output-file "example-4.coef")
(plot-file "example-4.plot")
(go)
This page maintained by: Matteo Frigo. Last updated: Sun Jan 6 06:31:03 2013
.