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.
Answer
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) = \frac{1+a}{2}\frac{(z-e^{+j\omega_n})(z-e^{-j\omega_n})}{(z-ae^{+j\omega_n})(z-ae^{-j\omega_n})} $$
Multiplying this out results in:
$$ H(z) = \frac{1+a}{2}\frac{z^2-2z\cos\omega_n+1}{(z^2-2az\cos\omega_n+a^2)} $$
So for your 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 and -1 corresponds to $F_s/2$, 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.
For example, see below digital notch filter with $a = .99$ and $\omega_n$ = 0.707. (Frequency axis is normalized where 1 = $f_s/2$
No comments:
Post a Comment