I tried to analytically construct a causal notch filter that stops frequencies at 50Hz and I thought if zeros are more than poles it will be non-causal so I chose equal amount of poles and zeros resulting in
$$\dfrac{\left(z-e^{100\pi i} \right)\left(z-e^{-100\pi i} \right)}{z^2} $$
Is this correctly designed and causal?
Answer
You've designed a causal filter with a notch at $\omega_0=100\pi$. But the result is probably not what you want. Note that you've designed an FIR (finite impulse response) filter. Its frequency response has a large overshoot towards high frequencies.
What you actually want is an IIR filter, with poles away from the origin of the complex $z$-plane. A simple way to design a notch filter is to place the zeros at the desired notch frequency (as you did), and place poles at the same angle but slightly inside the unit circle. If $0 $$H(z)=\frac{(z-e^{j\omega_0})(z-e^{-j\omega_0})}{(z-re^{j\omega_0})(z-re^{-j\omega_0})}=\frac{z^2-2z\cos(\omega_0)+1}{z^2-2zr\cos(\omega_0)+r^2}\tag{1}$$ You can apply scaling to the transfer function $(1)$ such that its gain at DC equals 1. Finally, note that you have to take the sampling frequency into account. The notch frequency $\omega_0$ in $(1)$ is normalized. If $f_0$ is the desired notch frequency in Hertz, and if $f_s$ is the sampling frequency in Hertz, then $$\omega_0=2\pi\frac{f_0}{f_s}$$ As an example, take $f_0=50\text{ Hz}$, $f_s=1000\text{ Hz}$, and $r=0.98$. The figure below shows the transfer function of the FIR notch filter you proposed (top), and the IIR transfer function according to Equation $(1)$ (bottom):
No comments:
Post a Comment