In some designs, it may be required to have a digital filter which attenuates a single frequency component with the rest of the frequencies pass through. Filtering out of the power line frequency of 50/60Hz or filtering of spurious correlated frequency signals in a wireless communication receivers etc are some possible scenarios. Such filters are called **notch filters** and this post goes over the digital notch filter described in the paper ”Design of Digital Notch Filters,” by Hirano, K.; Nishimura, S.; Mitra, S.K., in *Communications, IEEE Transactions on* , vol.22, no.7, pp.964,970, Jul 1974

## Filter Design

The transfer function of an analog notch filter is

, where

is the notch frequency and

is the width of the notch.

Converting to a digital filter using bilinear transformation,

.

Let

.

where.

Summarizing,

**To find the frequency where the response becomes zero**

.

Re-arranging and representing in terms of ,

.

The value is,

.

**To find the -3dB bandwidth frequency **

.

After some math**,

**** Note :** Did not figure out the math.

Re-arranging and representing in terms of ,

.

The value is,

.

## Representing as an All-Pass structure

The transfer function represented with and is,

.

This can be alternately represented as,

,

where

Re-arranging,

,

Replacing and ,

**Block diagram **

Multiple structures to implement the above equation is possible. One possible candidate having two delay elements and two multipliers is shown below.

** Figure : Block diagram notch filter (Reference Figure 3(a) Hirano, K.; Nishimura, S.; Mitra, S.K., “Design of Digital Notch Filters,” Communications, IEEE Transactions on , vol.22, no.7, pp.964,970, Jul 1974)**

**Matab code**

% Matlab code for plotting the frequency response of digital notch filter % Implemented as all pass filter section clear; close all fs = 1e6; fn = 200e3; fb = 50e3; omega0T = fn/(fs/2)*pi; deltaT = fb/(fs/2)*pi; a2 = (1-tan(deltaT/2))./(1+tan(deltaT/2)); a1 = (1+a2).*cos(omega0T); B = [1 -a1 a2]; A = [a2 -a1 1]; [H1 W1] = freqz(B,A,1024,'whole'); [H2 W2] = freqz(1,1,1024,'whole'); H3 = (H1+H2)/2; h = figure(1); subplot(2,1,1); plot([-512:511]/1024*fs/1e6,20*log10(fftshift(abs(H3))),'b-','LineWidth',4); grid on; ylabel('amplitude, dB'); title('notch filter, fs=1MHz, fn=200kHz, fb=50kHz'); axis([-0.5 0.5 -50 10]); subplot(2,1,2); plot([-512:511]/1024*fs/1e6,(fftshift(angle(H3)*180/pi)),'m-','LineWidth',4); grid on; xlabel('freq, MHz'); ylabel('angle, deg'); title('phase response'); axis([-0.5 0.5 -180 180]);

**Figure : Notch filter – frequency and phase response**

** **

## Reference

Hirano, K.; Nishimura, S.; Mitra, S.K., “Design of Digital Notch Filters,” *Communications, IEEE Transactions on* , vol.22, no.7, pp.964,970, Jul 1974

doi: 10.1109/TCOM.1974.1092311

URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1092311&isnumber=23820

D id you like this article? Make sure that you do not miss a new article
by subscribing to RSS feed OR subscribing to e-mail newsletter.
* Note: Subscribing via e-mail entitles you to download the free e-Book on BER of BPSK/QPSK/16QAM/16PSK in AWGN.*

{ 2 comments… read them below or add one }

Hi Krishna,

I enjoyed reading your articles a lot, however, lately I could not see the math equations due to mimetex error, the actual error message is something like “Only dsplog.com may use mimetex…”. I looked up the mimeTeX site and found the following solution:

If you install mimeTeX on one server and try to use it from another, you may instead see messages like

In this case, compile mimetex.cgi with the -DNOREFCHECK switch, e.g.,

cc -DAA -DNOREFCHECK mimetex.c gifsave.c -lm -o mimetex.cgi

and read the -DREFLEVELS=n discussion under compile options.

Please try and update your local mimeTeX server with -DNOREFCHECK, if you intent to us see the math equations.

Thanks and best regards,

Chien

@Chien: Oh… ! Thanks for letting know. I tried using multiple browsers (and computers) and was able to see the equations.

Can you please mail me the screenshot of the error – krishna < $AT$> dsplog.com

In anycase, will check the mimeTex compile options and get this resolved.