0
$\begingroup$

I started studying DSP recently. In my MATLAB assignments, I am often asked to plot the frequency response of a digital filter using freqz. I know there's another function for plotting a frequency response, bode.

In my last assignment, I was asked to design a notch filter for $60\textrm{ Hz}$ with a sampling frequency of $200\textrm{ Hz}$. After doing so, I plotted the frequency response using freqz, which gave me the expected result - the notch was on $60\textrm{ Hz}$:

freqz plot

However, when I plot the frequency response using bode, the frequency is off significantly:

enter image description here

To my understanding, both functions measure the frequency response. Why is one giving me the correct result then, when the other is not?

$\endgroup$
0
$\begingroup$

In fact both plots are the same.

Your freqz plot uses a linear discrete frequency, $\omega$ axis scaled between $0$ and $1$ with units of $\pi$ rad per sample. For 200 Hz sampling frequency, a 60 Hz notch would be shown at $w_c = 0.6 \pi$ rads, which is put at 0.6.

The bode plot, however, uses a logarithmic scale for the continuous-time radian frequency $\Omega$. Given that you have a $f_c=60$ Hz of notch frequency, its radian value is $\Omega_c = 2\pi \times 60 \approx 377$ radians per second.

So both plots are showing the notch at the correct place.

$\endgroup$
  • 1
    $\begingroup$ Thank you. I screwed up the conversion from Hz to radians. $\endgroup$ – Egor Tamarin May 31 '17 at 21:47

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.