<jupyter_start><jupyter_text>[<NAME>](https://orcid.org/0000-0001-7225-9992),Professorship Signal Theory and Digital Signal Processing,[Institute of Communications Engineering (INT)](https://www.int.uni-rostock.de/),Faculty of Computer Science and Electrical Engineering (IEF),[University of Rostock, Germany](https://www.uni-rostock.de/en/) Tutorial Signals and Systems (Signal- und Systemtheorie)Summer Semester 2021 (Bachelor Course 24015)- lecture: https://github.com/spatialaudio/signals-and-systems-lecture- tutorial: https://github.com/spatialaudio/signals-and-systems-exercisesWIP...The project is currently under heavy development while adding new material for the summer semester 2021Feel free to contact lecturer [<EMAIL>](https://orcid.org/0000-0002-3010-0294)  Übung / Exercise 8 Discrete-Time Convolution<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MaxNLocator
# signal
x = np.array([1, 1, 2, -1])  # non-zero elements
Nx = x.size
kx = 1  # start index for first non-zero entry

# signal, we can interpret this as impulse response of LTI system
h = np.array([2, 1, -1])
Nh = h.size
kh = 0

# convolution
Ny = Nx+Nh-1
ky = kx+kh
y = np.convolve(x, h)
plt.figure(figsize=(12, 3))

k = np.arange(kx, kx+Nx)
ax = plt.subplot(1, 3, 1)
plt.stem(k, x, use_line_collection=True,
         linefmt='C0:', markerfmt='C0o', basefmt='C0:',
         label=r'$x[k]$')
# ax.xaxis.set_major_locator(MaxNLocator(integer=True))
plt.xlabel(r'$k$')
# plt.ylabel(r'$x[k]$')
plt.legend()

k = np.arange(kh, kh+Nh)
ax = plt.subplot(1, 3, 2)
plt.stem(k, h, use_line_collection=True,
         linefmt='C0:', markerfmt='C0o', basefmt='C0:',
         label=r'$h[k]$')
# ax.xaxis.set_major_locator(MaxNLocator(integer=True))
plt.xlabel(r'$k$')
# plt.ylabel(r'$h[k]$')
plt.legend()

k = np.arange(ky, ky+Ny)
ax = plt.subplot(1, 3, 3)
plt.stem(k, y, use_line_collection=True,
         linefmt='C0:', markerfmt='C0o', basefmt='C0:',
         label=r'$y[k] = x[k]\ast h[k]$')
# ax.xaxis.set_major_locator(MaxNLocator(integer=True))
plt.xlabel(r'$k$')
# plt.ylabel(r'$y[k]$')
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1703117729176361, 'fraction_numerical': 0.035830618892508145, 'mean_word_length': 5.03932584269663, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '189802', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 912, 'n_tokens_neox': 835, 'n_words': 176, 'path': 'convolution_dt/convolution_discrete_FD58EEB1EC.ipynb', 'repo_name': 'spatialaudio/signals-and-systems-exercises', 'size': '2176'}