0
$\begingroup$

I have checked the theory to calculate the magnitude of frequency response from the pole-zero plot from the previous posts. As far as I understand(and I hope I am correct), the magnitude can be calculated from this formula.

|$H(z)| = \frac{|\prod_{n=0}^{n=\infty} (z-z_n)|}{|\prod_{n=0}^{n=\infty}(z-p_n)|}$

So, for this question, (no 11, fig. a), here

To visualize the frequency plot, I wrote the following Python code,

w = np.linspace(-np.pi,np.pi,100)
z = np.exp(1j*w)
cof1 = (0.9+0.1j)
cof2 = (0.9-0.1j)
eq = z**2 - ((cof1+cof2)*z)+(cof1*cof2)  //to find the equation from the roots
num = (z+1)**3
den = (z-0.8)*eq
y = num/den
plt.plot(w,np.sqrt(y.real**2+y.imag**2))

The code is not great but it kind of works (I think so). And, I took some approximate values for coefficient of poles. Anyway, I got the following output, here

which is wrong. The correct output is, here

I don't understand, where I went wrong. Why is there a significant gap in the magnitude between my output and the correct answer? I used the same code to calculate some other plots and it worked fine. But in this particular question, it didn't work. I hope my code is not wrong. Could anybody help me with this? I am trying to play around with the poles and zeros to see its relation with the magnitude of the frequency response curve.

$\endgroup$
9
  • $\begingroup$ I don't see anything in that figure given in the solution. What's that supposed to be? Your magnitude plot looks fine, it's just a low pass filter. Take a look at these questions for the relation between pole-zero plots and frequency responses: Q1, Q2, Q3. $\endgroup$ – Matt L. Feb 13 at 19:13
  • $\begingroup$ @MattL. there is a small bump between $-\pi/2$ and $\pi/2$. Though the magnitude is very small. This is the answer sheet provided by the lecturer and I don't understand it. And the answer to the rest of the figures is also similar. I can't seem to figure out the difference. $\endgroup$ – Rima Feb 14 at 6:11
  • $\begingroup$ I think I got my mistake. I should have used the range between -1 to 1 instead of $\pi$ and calculated in terms of z rather than $e^(j\omega)$ because of which there is a large gap in the magnitude. thanks for the reference. $\endgroup$ – Rima Feb 14 at 8:54
  • $\begingroup$ I don't think that you made a mistake. The frequency response is obtained by using $z=e^{j\omega}$, and $\omega$ is in the range $[-\pi,\pi]$. I'm quite sure that the problem lies in the solution. I mean, what are those strange lines supposed to be that extend over all the figures? $\endgroup$ – Matt L. Feb 14 at 11:49
  • $\begingroup$ This question has a few very related exercises. Many more nice matching exercises can be found here. $\endgroup$ – Matt L. Feb 14 at 12:34

Your Answer

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

Browse other questions tagged or ask your own question.