12.5. Exercises#

Exercise 12.1

Compute the poles and zeros of each of the following filters. Which ones are stable?

  1. \(y[n] = \frac{1}{2} \cdot x[n] + \frac{1}{2} \cdot y[n-1] - y[n-2]\)

  2. \(y[n] = x[n] + x[n-2] - 2 \cdot y[n-1]\)

Exercise 12.2

A system is given to you with poles at \(\{0.5 + 0.5 \mathrm{j}, 0.5 - 0.5\mathrm{j}\}\) and zeros at \(\{-0.5, +0.5\}\).

  • Create a pole-zero plot for this system, similar to Fig. 12.7 (left).

  • Is the system stable?

  • Is the system high-pass, low-pass, or neither?

Exercise 12.3

We’ve seen the function scipy.signal.tf2zpk, which produces the zeros, poles, and gain of a filter when given the feed-forward and feed-back coefficients b and a. There is also a function which reverses this process, scipy.signal.zpk2tf.

Starting from the example code given in Section 12.3.2.2, construct an elliptic filter with the following properties: sampling rate of \(f_s=44100\), cutoff frequency of \(f_c=16000\), transition bandwidth of 2000 Hz, pass-band ripple of 3dB, and stop-band attenuation of 120dB.

  • Use tf2zpk to calculate the zeros, poles, and gain of the filter.

  • Use zpk2tf to derive new filters with the following properties:

    • poles = [] (i.e., no poles), but with zeros and gain from the original filter;

    • zeros = [] (i.e., no zeros), but with poles and gain from the original filter.

    • Substitute the poles for zeros and vice versa, e.g., scipy.signal.zpk2tf(poles, zeros, gain).

For each of these three filters (original, no-poles, no-zeros, swapped), plot the resulting frequency response curves given by scipy.signal.freqz. How do the modified filters differ from the original?