# Filter to eliminate a 60 Hz frequency range

I have a analog signal that is converted into a discrete-time signal with an ideal A/D converter with a sampling frequency $$fs$$. The bandwidth of the signal of interest is $$1 kHz$$. The resulting signal $$x[n] = x_a(nT_s)$$ is then processed with a discrete-time system that is described by the difference equation:

$$y[n] = x[n]+ax[n-1]+bx[n-2]$$

The filtered signal, $$y[n]$$, is then converted back into an analog signal using an ideal D/A converter. I need to determine values for $$fs$$, $$a$$ and $$b$$ in order to remove a $$60Hz$$ interference that has a signal in the form: $$i_a(t) = Asin(120 \pi t)$$

By Nyquist, I know that the value of $$fs$$ needs to be greater than $$2000Hz$$, however, I don't know how to determine $$a$$ and $$b$$. Any thoughts?

• Does this answer your question? Transfer function of second order notch filter Apr 22 at 23:10
• How can i determine a and b with that information? Apr 23 at 0:08
• Put your equation in transfer function form and it should be clearer. Is this a homework problem? Apr 23 at 0:09
• It's a exercise from a old PSET [link] (people-ece.vse.gmu.edu/~hayes/courses/SignalAnalysis/…). I have found $w_n$, but what i do with that? @DanBoschen Apr 23 at 0:34

The OP is trying to implement a notch filter with a 3 tap FIR filter (as restricted by the problem he is trying to solve). It must be noted that this would result in a very poor filter implementation: It will reject 60 Hz perfectly but will have unavoidable attenuation over a very broad section of the desired passband range. An actual practical implementation would be done with an IIR approach in order to provide a tight notch, as demonstrated by this link: Transfer function of second order notch filter

As a hint to determine the filter within this FIR restriction, as an exercise only and of no real practical value proceed as follows:

Take the Z transform of the difference equation.

Determine the transfer function form as a polynomial ratio $$H(z) = Y(z)/X(z)$$

From this know that the frequency response is determined by restricting $$z$$ to the unit circle ($$z= e^{j\omega}$$) with $$\omega$$ extending uniquely over the normalized radian frequency from $$-\pi$$ to $$+\pi$$ which corresponds to $$-f_s/2$$ to $$+f_s/2$$ where $$f_s$$ is the sampling rate.

Given this is an FIR structure, the transfer function will result in simply a 2nd order polynomial in the numerator (whos roots are the "zeros" of the filter). Place the zeros of this polynomial such that they corresponds to the 60 Hz locations on the unit circle (+/- 60 Hz for a real filter, mapped to the angular frequency as described above), which would provide complete attenuation at f = 60 Hz.

• I get it! I agree with you, if I were to implement a notch filter properly, i would take into account the answer you mentioned. I got $a = -1.96457$ and $b=1$. Thanks! Apr 23 at 1:14
• @JulyH. Good job, what sampling rate did you end up using? I'll check your answer. What's interesting about the answer I referenced is that you just add a pole near this zero but inside the unit circle to be stable and wala! Apr 23 at 1:15
• I used $f_s = 2000Hz$. I dont understand why in the PSET, the answer for $a$ is $-2cos( \frac{60}{f_s})$ Apr 23 at 1:17
• Look at Euler's identity for cos: $(1/2) e^{j \omega t} + (1/2) e^{-j \omega t}$ and then think of what I described in my answer: these are the desired root locations. I have to work through the math to check there/ your answer which may be the same. Apr 23 at 1:21
• I see. But $a = 1.96457$ it's not a wrong answer, right? Apr 23 at 1:26