Exercises
3.7. Exercises#
For each of the following systems, what is its impulse response?
\(y[n] = x[n] - x[n-1]\)
\(y[n] = 2\cdot x[n] + x[n-2]\)
\(y[n] = \frac{1}{3} \cdot \left(x[n-2] + x[n-3] + x[n-4]\right)\)
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?
Full
Valid
Same (centered)
For each of the following systems, determine whether it is linear, shift-invariant, both, or neither.
\(y[n] = -x[n]\)
\(y[n] = x[0]\)
\(y[n] = \frac{1}{2} \cdot |x[n] + x[n-1]|\)
\(y[n] = 20\)
\(y[n] = n^2\)
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)