11
$\begingroup$

Can anyone mention the transfer function of second order notch filter to remove the line frequency of 50 Hz, in terms of frequency and sampling rate.

Just like for Low pass Butterworth filter as,

$$ H= \frac{1}{\sqrt{1+\left(\frac{\omega_n}{\omega_c}\right)^4}}, $$

where $\omega_n$ is the signal frequency and $\omega_c$ the cutoff frequency.

$\endgroup$

2 Answers 2

22
$\begingroup$

For digital notch filters, I like to use the following form for a notch filter at DC ( $ \omega $=0):

$$ H(z) = \frac{1+a}{2}\frac{(z-1)}{(z-a)} $$

where $a$ is a real positive number < 1. The closer $a$ is to 1, the tighter the notch (and the more digital precision needed to implement).

This is of the form with a zero = 1, and a pole = $a$, where $a$ is real. The multiplication by $\frac{1+a}{2}$ is just to normalize the magnitude back to 1. To move this to a frequency, rotate the pole and zero to the frequency desired. For a real filter we end up with complex conjugate pole zero pairs, resulting in a 2nd order filter:

Defining a digital frequency range of 0 to 2$\pi$, with the sampling frequency at $f_s=2\pi$ and the notch frequency is $\omega_n$, then if we rotated the pole and zero above to $\omega_n$ we would get:

$$ H(z) =K\frac{(z-e^{+j\omega_n})(z-e^{-j\omega_n})}{(z-ae^{+j\omega_n})(z-ae^{-j\omega_n})} $$

Multiplying this out and setting $z= -1$ to determine $K$ results in:

$$ H(z) = K\frac{z^2-2\cos\omega_n z +1}{(z^2-2a\cos\omega_n z+ a^2)} $$

$$K = \frac{1+2a\cos(\omega_n)+a^2}{2+2\cos(\omega_n)}$$

As $\alpha \rightarrow 1$, $K \rightarrow 1$, so $K$ can be omitted in many cases.

For the OP's case of 50Hz, if we assume a sampling frequency of 1KHz, $\omega_n$ would be:

$$ \omega_n =\frac{f_c}{f_s}= \frac{50}{1000}2\pi$$

The coefficient $a$ is chosen to balance precision needed and bandwidth (bandwidth is tighter as $a$ approaches 1), and $cos(\omega_n)$ is a value between +1 and -1 that sets the frequency of the notch (+1 corresponds to DC with $\omega_n=0$ and -1 corresponds to $F_s/2$ with $\omega_n=\pi$, and any values in between for all frequencies in the first Nyquist zone.)

One possible implementation (using transposed Direct Form II) for this transfer function is shown below.

Transposed Direct Form 2

For example, see below digital notch filter with $a = .99$ and $\omega_n$ = 0.707. (Frequency axis is normalized where 1 = $f_s/2$

notch example

Update: Please see further details including the closed form equation for the bandwidth of the notch for a given $\alpha$ here.

$\endgroup$
0
3
$\begingroup$

filters other than notch filter can be used like normal low pass filter also moving average filter (MAF) can be used enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.