Blogs

A Wide-Notch Comb Filter

Rick LyonsNovember 24, 201913 comments

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

Background

Let's first review the behavior of a traditional comb filter. Figure 1(a) shows a traditional comb filter comprising two cascaded recursive running sum (RRS) comb filters. Figure 1(b) shows the filter's co-located dual poles and dual zeros on the 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 fs/D Hz where fs is the input signal sample rate measured in Hz.

This article is available in PDF format for easy printing

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

The Wide-Notch Comb Filter

Figure 2(a) shows the wide-notch comb filter's block diagram. Figure 2(b) shows the filter's co-located dual poles and dual zeros on the 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.

The wide-notch comb filter has a high low-frequency gain, just as do cascaded integrator-comb filters (CIC) filters. So to avoid register overflow the filter should be implemented using two's complement arithmetic for the reasons described in Reference [2].

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 = D2C. (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

I've discussed the development and performance of the wide-notch comb filter in Figure 2(a) that may prove beneficial in applications that have previously used traditional recursive running sum (RRS) comb filters. In addition, Appendix B shows how to implement a unity passband gain wide-notch comb filter.

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 derivation of this blog's Eq. (1) is described as follows: The foundation of the proposed wide-notch comb filter is two cascaded Recursive Running Sum filters as shown in Figure A-1(a).

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:

The initial structure of a wide-notch comb filter, with its three long delay lines, is shown in Figure A-1(b). That filter was inspired by a recursive filter proposed in Reference [1]. The Figure A-1(b) filter's 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

To implement a unity passband (at zero Hz) gain wide-notch comb filter we must reduce the Figure 2(a) filter's gain by a factor of D2C. 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 D2C.

In fixed-point implementations, to reduce the necessary word width of the 3rd and 4th accumulators (3rd and 4th adders) and the zD 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:

WARNING: 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.


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

[ - ]
Comment by asnNovember 25, 2019

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




[ - ]
Comment by Rick LyonsNovember 25, 2019

Hi.

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

[ - ]
Comment by Rick LyonsNovember 25, 2019

Hi Sanjeev.

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

[ - ]
Comment by asnNovember 26, 2019

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.

[ - ]
Comment by hirnprinzNovember 26, 2019

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?

[ - ]
Comment by Rick LyonsNovember 26, 2019

Hi hirnprinz.

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

drawing3_70519.jpg

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!!

[ - ]
Comment by hirnprinzNovember 27, 2019

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!

[ - ]
Comment by asnNovember 26, 2019

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)

nbcomb_88412.jpeg

WB comb (group delay: 9 samples)

wbcomb_43778.jpeg


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.

[ - ]
Comment by noriNovember 26, 2019
[ - ]
Comment by Rick LyonsNovember 28, 2019

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.

[ - ]
Comment by Rick LyonsNovember 26, 2019

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.

[ - ]
Comment by forthprgrmrDecember 11, 2019

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.

[ - ]
Comment by Rick LyonsDecember 11, 2019

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.

Sign up

I agree with the terms of use and privacy policy.

Try our occasional but popular newsletter. VERY easy to unsubscribe.
or Sign in