3.7. Exercises#

Exercise 3.1

For each of the following systems, what is its impulse response?

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

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

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

Exercise 3.2

If \(x\) is a signal of \(N=100\) samples, an \(h\) is an impulse response of \(K=11\) samples, how many samples does \(y=h*x\) have in each of the following modes?

  1. Full

  2. Valid

  3. Same (centered)

Exercise 3.3

For each of the following systems, determine whether it is linear, shift-invariant, both, or neither.

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

  2. \(y[n] = x[0]\)

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

  4. \(y[n] = 20\)

  5. \(y[n] = n^2\)

Exercise 3.4

Let \(h = [1/K, 1/K, \dots, 1/K]\) (\(K\) times) denote a moving average filter so that if \(y = h*x\), then \(y[n]\) is the average of the previous \(K\) samples in \(x\).

Using an input recording \(x\) of your choice (not more than 10 seconds), compute \(y\) for different values of \(K = 1, 4, 16, 64, 256, 1024\) and listen to each one.

How does each \(y\) sound compared to the original signal? Do you notice any artifacts?

# Starter code for making a moving average filter
K = 8
h_K = 1/K * np.ones(K)