1
$\begingroup$

I'm attempting to design a FIR high pass filter than keeps signals above 200Hz and rejects signals below 60Hz with a sampling frequency of 500 samples/sec. This is my first time attempting this and I'm a little confused.

I started with looking at pole/zero placement. I'm not exactly sure how to go about this but this is what I did. I want a zero on the unit circle at the 60Hz point to minimize that frequency. To find this spot on the axis I did the following:

$$\frac{60}{\frac{500}{2}}\pi=0.24\pi$$

So I believe I need a zero at 0.24pi on the unit circle on the z-plane. Does this sound right? How would I then transform it in a difference equation in the sequence domain?

$\endgroup$
  • $\begingroup$ well, if it's FIR, all of your poles will be placed at the origin: $z=0$. $\endgroup$ – robert bristow-johnson Nov 8 '14 at 22:13
  • $\begingroup$ Is this a toy problem that you want to (have to) solve by hand, or do you want a 'real' design (for which you would normally use some software)? $\endgroup$ – Matt L. Nov 8 '14 at 23:13
  • $\begingroup$ By hand preferably. I'm working on the basics right now $\endgroup$ – codedude Nov 9 '14 at 3:37
2
$\begingroup$

This is how you can try to design a short and simple FIR filter by hand. Note that this method is just supposed to be enlightening, a really useful filter can be designed using some software. If you want a zero at 60 Hz you indeed need to place it at an angle of $0.24\pi$ on the unit circle of the $z$-plane. The general relation between angle and frequency is

$$\phi=2\pi\frac{f}{f_s}$$

where $f$ is the desired frequency, and $f_s$ is the sampling frequency. Note that if the filter coefficients are real-valued, zeros (and poles) always occur in complex conjugate pairs. So if you have a zero at $z=z_0$ you must also have a zero at $z=z_0^*$. This just reflects the fact that the spectrum of a real-valued filter is symmetric: $H(\omega)=H^*(-\omega)$. Since you want to design a causal FIR filter, all poles are at the origin of the $z$-plane, and you only have control over the zeros.

So let's design an FIR filter of order $3$ (i.e. length $4$) with a zero at $z_0=e^{j0.24\pi}$, and - because it's a high pass filter - a zero at $z=0$. The zero at $z=0$ contributes a factor

$$H_1(z)=1-z^{-1}$$

to the total transfer function, and the zero at $z_0=e^{j0.24\pi}$ (and its complex conjugate counterpart at $z_0^*=e^{-j0.24\pi}$) contributes a factor

$$H_2(z)=(1-z_0z^{-1})(1-z_0^*z^{-1})=1-(z_0+z_0^*)z^{-1}+|z_0|^2z^{-2}=\\ =1-2\Re\{z_0\}z^{-1}+z^{-2}=1-2\cos(0.24\pi)z^{-1}+z^{-2}$$

because $z_0+z_0^*=2\Re\{z_0\}=2\cos(0.24\pi)$, and $|z_0|=1$ (the zero is on the unit circle). The total transfer function is

$$H(z)=H_1(z)H_2(z)=(1-z^{-1})(1-2\cos(0.24\pi)z^{-1}+z^{-2})=\\ =1-[1+\cos(0.24\pi)]z^{-1}+[1+\cos(0.24\pi)]z^{-2}-z^{-3}\tag{1}$$

From (1) you can read the filter coefficients:

$$h_0=1,\quad h_1=-[1+\cos(0.24\pi)]=-2.4579,\quad h_2=-h_1,\quad h_3=-h_0\tag{2}$$

Note that we just imposed the locations of the zeros but we didn't apply any normalization. A useful normalization for a highpass filter is to require $H(-1)=1$, i.e. the response at the Nyquist frequency (half the sampling frequency) is $1$. Since

$$H(-1)=\sum_n(-1)^nh[n]=h[0]-h[1]+h[2]-h[3]=2h[0]-2h[1]$$

we can define new normalized filter coefficients by

$$\hat{h}[n]=\frac{h[n]}{2(h[0]-h[1])},\quad n=0,1,2,3$$

The magnitude of the resulting frequency response of this filter looks like this (the phase is linear due to the symmetry of the coefficients):

enter image description here

You see that the three constraints (zeros at DC and at 60 Hz, and unity response at Nyquist) are satisfied. The transition from stopband to passband is of course not very steep but that's as good as it gets with an FIR filter of order 3.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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