0

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?

carraro
  • 13
  • 5

1 Answers1

1

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.

Dan Boschen
  • 50,942
  • 2
  • 57
  • 135
  • 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! – carraro Apr 23 '21 at 01:14
  • 1
    @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! – Dan Boschen Apr 23 '21 at 01:15
  • I used $f_s = 2000Hz$. I dont understand why in the PSET, the answer for $a$ is $-2cos( \frac{60}{f_s})$ – carraro Apr 23 '21 at 01: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. – Dan Boschen Apr 23 '21 at 01:21
  • I see. But $a = 1.96457$ it's not a wrong answer, right? – carraro Apr 23 '21 at 01:26
  • No that's not the right answer. angle(roots([1 +1.96457 1]))2000/(2pi) comes out to +/- 940 Hz is where you have your zeros placed. You're close, you just have a sign error on your a somehow. – Dan Boschen Apr 23 '21 at 01:31
  • I did this: $$H(e^{jw}) = (1-e^{-j0.06 \pi}e^{jw})(1-e^{j0.06 \pi}e^{jw})$$ Distributing the terms, I arrived at the results I showed earlier. – carraro Apr 23 '21 at 01:41