2
$\begingroup$

I need to find the filter coefficients of an FIR filter that will block sinusoids of frequency $200\ \rm Hz$ if the sinusoid is sampled at $1.2\ \rm kHz$.

I feel like this is a fairly simple problem, but I'm not exactly sure how to go about it.

I am thinking I need to convert the frequencies to rad/s, then use these values in the transfer function, but am not sure how to find this transfer function.


EDIT:

I have to choose from one of the possible options:

$$ \{1, 1, 1\} $$ $$ \{1, -1, 1\} $$ $$ \{1, 0, 1\} $$ $$ \{1, \sqrt{2}, 1\} $$

or None of the Above.

From the coefficients above, I know the following equations can be created:

\begin{align} H\left(e^{j\omega}\right)&=1+e^{-j\omega}+e^{-2j\omega}\\ H\left(e^{j\omega}\right)&=1-e^{-j\omega}+e^{-2j\omega}\\ H\left(e^{j\omega}\right)&=1+e^{-2j\omega}\\ H\left(e^{j\omega}\right)&=1+\sqrt{2}e^{-j\omega}+e^{-2j\omega} \end{align}

$\endgroup$
  • 1
    $\begingroup$ One of the most basic design is based on the window method dsprelated.com/freebooks/sasp/Window_Method_FIR_Filter.html Let me suggest you to first elaborate on this approach, to help readers guide you further $\endgroup$ – Laurent Duval Dec 16 '17 at 16:52
  • 1
    $\begingroup$ Yet another source: allaboutcircuits.com/technical-articles/… $\endgroup$ – Laurent Duval Dec 16 '17 at 16:53
  • $\begingroup$ Hello, will your filter only block 200 Hz or block 200 Hz and above / below? Also what about other frequencies? In other words, please specify your filter characteristic in more detail. $\endgroup$ – Fat32 Dec 16 '17 at 16:57
  • $\begingroup$ @Fat32 The FIR filter needs to only block sinusoids of 200 Hz, so all other frequencies can be passed through $\endgroup$ – Sara Tibbetts Dec 16 '17 at 16:58
  • $\begingroup$ So you need a notch filter indeed? Or some sort of moving average will help. The moving average will be FIR and linear phase but will distort the spectrum, whereas the notch will be IIR instead of FIR but will pass all other frequencies perfect? so what's your opinion? $\endgroup$ – Fat32 Dec 16 '17 at 17:03
2
$\begingroup$

The general formula for the frequency response of a causal second-order FIR filter with a pair of complex zeros on the unit circle is

$$H(e^{j\omega})=G(1-e^{j\omega_0}z^{-1})(1-e^{-j\omega_0}z^{-1})\tag{1}$$

where $\omega_0$ is the (normalized) frequency in radians where the zero occurs, and $G$ is a (real-valued) gain constant. If we choose $G=1$ and expand $(1)$ we obtain

$$H(e^{j\omega})=1-(e^{j\omega_0}+e^{-j\omega_0})z^{-1}+z^{-2}=1-2\cos(\omega_0)z^{-1}+z^{-2}\tag{2}$$

In your example we have

$$\omega_0=2\pi\frac{f_0}{f_s}=2\pi\frac{200}{1200}=\frac{\pi}{3}\tag{3}$$

where $f_0$ is the frequency of the zero, and $f_s$ is the sampling frequency. Plugging $(3)$ into $(2)$ with $\cos(\pi/3)=\frac12$ gives

$$H(e^{j\omega})=1-z^{-1}+z^{-2}\tag{4}$$

which corresponds to the impulse response $\{1,-1,1\}$.

$\endgroup$
0
$\begingroup$

Since you want a linear phase FIR filter. And since you only want to null a given single selected frequency. Then from the given set of filters the one: $$ h[n] = \delta[n] - \delta[n-1] + \delta[n-2] $$ will do the job, as shown by its frequency response plot generated by MATLAB/Octave freqz() function as below:

enter image description here

Note that eventhough this spectrum seems like a good notch with an infintely deep null at the frequency 200 Hz, a close look at the frequency response, as in the next figure, would reveal that there's significand (linear) distortion on the large portion of the spectrum, which may be undesirable depending on the application. This distortion can be perfectly corrected by post-processing however.

enter image description here

$\endgroup$
  • $\begingroup$ If you were unable to use Matlab to plot this, how would you know this filter was the correct one? $\endgroup$ – Sara Tibbetts Dec 16 '17 at 18:07
  • $\begingroup$ I have plotted them because you gave the pre-designed filter choices. You can also evalaute their freqency response magnitudes by simply computing N points of $|H(e^{j\omega})|$ for $0 < \omega < 2\pi $. You can also design a three coefficient FIR filter that would null a single selected frequency by a very simple formula. $\endgroup$ – Fat32 Dec 16 '17 at 20:50
  • 1
    $\begingroup$ Furthermore you can also find the nulling frequency of the three coefficient FIR filter by finding the roots of the second order polynomial associated with the coefficients of the FIR filter. If you have further questions on this you can ask a new question with more details. $\endgroup$ – Fat32 Dec 16 '17 at 21:00
  • $\begingroup$ @SaraTibbetts That latter approach is linked with pole-zero placement design method. A root of FIR polynomial is a zero and a root of an IIR polynomial is a pole. Given a root like $ r e^{j\theta$ defines a frequency at $\theta$ radians where the actual frequency is found from sampling rate. $\endgroup$ – Fat32 Dec 16 '17 at 21:06

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.