# A Wide-Notch Comb Filter

This blog describes a linear-phase comb filter having wider stopband notches than a traditional comb filter.

__Background__

*z*-plane, while Figure 1(c) shows the filter's positive-frequency magnitude response when, for example,

*D*= 9. The stopband notches (nulls) are located at integer multiples of

*f*

_{s}/

*D*Hz where

*f*

_{s}is the input signal sample rate measured in Hz.

In what follows we show a comb filter having wider stopband notches than are shown in Figure 1(c).

__The Wide-Notch Comb Filter__

*z*-plane, while Figure 2(c) shows the filter's frequency magnitude response when, for example,

*D*= 9 and C = 0.05.

As described in Appendix A, the *z*-domain transfer function of the proposed wide-notch comb filter is:

Figure 2(a)'s feedforward signal path using coefficient *C* imparts the four following favorable characteristics to the wide-notch filter:

The filter's frequency-domain notch width and the peak of the mini-sidelobes within the notches depend on both the delay line length *D* and the *C* coefficient. In most comb filter applications variable *D* is a fixed value, so coefficient *C* becomes the primary control variable to influence the filter's notch characteristics.

Values in the range 0.01 ≤ *C* ≤ 0.1 are reasonable for coefficient *C* to start any software modeling of the wide-notch comb filter. What you will find is that when you double the value of the *C* coefficient the peak of the mini-sidelobes within the notches increases by roughly six dB.

__A Unity-Gain Wide-Notch Comb Filter__

The lowpass gain (gain at zero Hz) of the Figure 2(a) wide-notch comb filter is:

gain = *D*^{2}—*C*. (2)

Appendix B shows how to implement a unity-gain wide-notch comb filter.

__When to Use the Wide-Notch Comb Filter__

The wide-notch comb filter can be useful in reducing the computational workload of interpolated finite-impulse response filters [1,2] and specialized narrowband lowpass IIR filters [3,4], as well as reducing the aliasing error caused by sample rate change in even-ordered cascaded integrator-comb filters (CIC) filters [5]. Another potential application of a wide-notch comb filter is its use as a comb filter for attenuating noise contamination from AC power line harmonics.

__Conclusion__

__References__

[1] G. Dolecek, and V. Dolecek, "Multistage Digital Filter", *13th International Research/Expert Conference*, Hammamet, Tunisia, Oct. 2009, Available online: http://www.tmt.unze.ba/zbornik/TMT2009/096-TMT09-147.pdf

[2] R. Lyons, "Understanding cascaded integrator-comb filters", Available online: https://www.embedded.com/understanding-cascaded-integrator-comb-filters/

[3] R. Lyons, "Improved Narrowband Lowpass IIR Filters in Fixed-Point Systems". *IEEE Signal Processing Magazine*. March, 2009. Available online: https://www.researchgate.net/publication/224397424_Improved_narrowband_low-pass_IIR_filters_in_fixed-point_systems_DSP_Tips_Tricks

[4] F. Harris and W. Lowdermilk, "Implementing Recursive Filters with Large Ratio of Sample Rate to Bandwidth", in *Conference Record of the Forty-First Asilomar Conference on Signals, Systems and Computers*, Pacific Grove, CA, Nov. 4–7, 2007, pp. 1149–1153. Available online: https://s3.amazonaws.com/embeddedrelated/user/124841/narrowband%20iir%20filters_2_40945.pdf

[5] R. Lyons, "Turbocharging Interpolated FIR Filters", *IEEE Signal Processing Magazine*, Vol. 24, No. 5, Sept. 2007. Available online: https://www.researchgate.net/publication/277702593_Turbocharging_Interpolated_FIR_Filters

[6] R. Lyons, "Controlling a DSP Network's Gain: A Note For DSP Beginners", available online at: https://www.dsprelated.com/showarticle/1249.php

__Appendix A: Derivation of Eq. (1)__

The *z*-domain transfer functions of a single RRS network and the cascaded Figure A-1(a) network are given in the following two equations:

*z*-domain transfer function is:

We can eliminate one of Figure A-1(b)'s long delay lines using the proposed network given in this blog's Figure 2(a) whose* z*-domain transfer function is also given by Eq. (A-3).

__Appendix B__

*D*

^{2}‑

*C*. The simplest method to do this is shown in Figure B-1(a). There we merely scaled the filter's output sequence by the reciprocal of the Figure 2(a) filter's passband gain of

*D*

^{2}‑

*C.*

In fixed-point implementations, to reduce the necessary word width of the 3rd and 4th accumulators (3rd and 4th adders) and the *z*^{‑D} delay line, the distributed scaling method in Figure B-1(b) can be used. Equation (B-1) gives the transfer function for both filters in Figure B-1:

**On the Internet I've seen digital filter gain reduction implemented with an attenuator at a filter's input as shown in Figure B-2.**

__WARNING:__Such a gain reduction method is a bad idea for the reasons discussed in Reference [6].

**Previous post by Rick Lyons:**

The Risk In Using Frequency Domain Curves To Evaluate Digital Integrator Performance

**Next post by Rick Lyons:**

Update To: A Wide-Notch Comb Filter

- Comments
- Write a Comment Select to add a comment

Dear Rick,

I implemented your design in ASN filterScript, see here for the video: Wide band notch filiter video

Very nice idea indeed!

Regards,

Sanjeev

Here's the filterscript code if you want to try it youself:

// Description: The Wide-Notch Comb Filter

// Author: Rick lyons

// Date: Monday, 25 November 2019

// Comments:

//

ClearH1; // clear primary filter from cascade

interface D = {2,20,1,9}; // interface variable definition

interface C = {0, 0.5,0.01,0.05};

Main() // main loop

// 1 - Cz^-(D-1) -2(1-C)z^-D + z^-2D

// H(z) = ----------------------------------

// 1 - 2z^-1 + z^-2

Num = {1, zeros(D-2), -C, -2*(1-C), -C, zeros(2*D-(D+2)),1}; // define numerator coefficients

Den = {1,-2,1}; // define denominator coefficients

Gain = 1/(D^2-C); // define gain

Hi.

My my, what a great video. Good job Sanjeev. You are a filter maestro!

Hi Sanjeev.

Your video is a nice demonstration of the power of your ASN Filter Design software.

Thanks, Rick! As I mentioned, I was really impressed by your idea, and look forward to seeing more filters along simular lines.

I assume that you still have a licenced version of the ASNFD? As it makes experimenation much more easier....

with kind regards,

Sanjeev.

Hello Rick,

first of all thank you for sharing with us the wide-notch comb filter. I have two questions:

1) have you compared the passband behavior of the proposed wide-notch comb filter with the traditional dual cascaded RRS filter? (cutoff frequency / attenuation)

2) How difficult would it be to increase the "order" of the wide-nocht comb filter? Right now it is based on a dual cacaded RRS filter and lets imagine one is interested in in a third order RRS?

Hi hirnprinz.

1) Yes, I sure did. I created the following drawing but chose not to include it in my blog.

2) Your notion of increasing the order of the wide-notch comb is an interesting idea. An idea I didn't explore. Off the top of my head my guess is that three cascaded RRS sections couldn't be made to work properly, but four cascaded RRS section might prove to be interesting. I'll look into your interesting idea.

hirnprinz, your second question is one of those wonderful "What happens if ..." questions. ("What happens if we increase the order of the wide-notch comb filter?") Such "What happens if ..." questions often lead to discoveries!!

Hi Rick,

thanks for the additional figures. I really like your idea more and more ...

Looking forward to see where the journey of this "what happens if" question will take you!

Dear Rick,

Here's a comparsion of your WB filter (C=0.1, D=10) vs the standard NB comb for a 50Hz harmonics attenuation case:

Standard comb (group delay: 2.5 samples)

WB comb (group delay: 9 samples)

As seen, there's about a 30dB improvement around 50Hz! The WB filter a larger group delay. However, what I really like, is that we can still get 60dB attentuation around the harmonics even when the powerline flucuates, i.e. 50Hz ± 1%

with kind regards,

Sanjeev.

Mr T is wrong sometimes.

Hi nori.

Ha ha. No, Mr. T is not wrong. It's my fault. I drew the Figure 1(a) standard exponential averager the same way it's typically shown in the literature of DSP. I should have drawn it with the 'multiply-by-alpha' operation at the y(n) output, rather than at the x(n) input. nori, thanks for pointing that out to me.

Hi Sanjeev.

I agree with your interesting observations.

Your first spectral magnitude plot puzzled me at first. But now I think it's the freq magnitude plot for a simple delay-line comb filter with no integrator (no accumulator). I think your delay-line comb's impulse response is:

h(k) = [1, 0, 0, 0, 0, -1]

and the sample rate is 250 samples/second.

So can I implement a CIC filter with a parallel D-1 delay (and summer) to do wide-notch filtering and decimation?

I typically sample much faster than needed, do a simple low pass, but then need to get rid of power line noise in my filtered (ecg or eeg) data.

Hi forthprgrmr. I don't understand what your words "parallel D-1 delay (and summer)" mean. Can you give me a block diagram of the filter you have in mind?

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.