procedure NotchFilter(NotchFrequency: Double; r: Double; Num: TVec; Den: TVec; FS: Double);
Design a second-order IIR notch (band-reject) filter.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | NotchFrequency | Double | scalar |
| 2 | r | Double | scalar |
| 3 | Num | TVec | source TVec |
| 4 | Den | TVec | source TVec |
| 5 | FS | Double | scalar |
Result: stored in self (calling object)
Builds the transfer function of a notch that rejects NotchFrequency and stores it in num (numerator) and den (denominator) for use with IirInit / IirFilter. With a = 2pi NotchFrequency/FS the coefficients are
H(z) = (1 - 2cos(a) z^(-1) + z^(-2))/(1 - 2rcos(a) z^(-1) + r^2 z^(-2))
The numerator places a zero exactly on the unit circle at e^(+/- j a) so the gain at the notch frequency is 0; the pole radius r (just inside the unit circle) sets the notch width and depth - r closer to 1 gives a narrower, deeper notch and a longer transient. Domain: and 0 < NotchFrequency < FS/2; values outside these ranges raise an exception. FS is the sampling frequency (default 2).