-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init mods for distance learning summer 2020
- Loading branch information
Showing
39 changed files
with
5,112 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# signals-and-systems-exercises | ||
Exercises for the bachelors course Signals and Systems | ||
|
||
## Tutorial | ||
|
||
**Continuous- and Discrete-Time Signals and Systems - A Tutorial with Computational Examples** | ||
|
||
- https://github.com/spatialaudio/signals-and-systems-exercises | ||
|
||
## Lecture | ||
|
||
This Jupyter notebook based tutorial using Python is accompanying the lecture | ||
|
||
**Continuous-Time and Discrete-Time Signals and Systems - Theory and Computational Examples** | ||
|
||
- https://github.com/spatialaudio/signals-and-systems-lecture | ||
|
||
Lecture and tutorial are designed for International Standard Classification of Education (ISCED) level 6. | ||
|
||
## License | ||
|
||
- Creative Commons Attribution 4.0 International License (CC BY 4.0) for text/graphics | ||
- MIT License for software | ||
|
||
## Referencing | ||
|
||
Please cite as | ||
|
||
Frank Schultz, | ||
*Continuous- and Discrete-Time Signals and Systems - A Tutorial with Computational Examples*, | ||
University of Rostock, | ||
https://github.com/spatialaudio/signals-and-systems-exercises, | ||
Either: SHA of the master branch commit to be cited. Year of commit. | ||
Or: zenodo.org DOI. release year of DOI. | ||
|
||
## DOI Versions | ||
|
||
- summer term 2020: TBD | ||
|
||
## Authorship | ||
|
||
University of Rostock: | ||
|
||
- Frank Schultz (concept, design, main author) | ||
- Till Rettberg (concept, design) | ||
- Sascha Spors (proof reading, concept) | ||
- Matthias Geier (proof reading, technical advisor) | ||
- Vera Erbes (proof reading) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Sphinx>=1.3.6 | ||
Sphinx-RTD-Theme | ||
nbsphinx | ||
ipykernel | ||
sphinx_bootstrap_theme |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Prof. [Sascha Spors](https://orcid.org/0000-0001-7225-9992),\n", | ||
"Professorship Signal Theory and Digital Signal Processing,\n", | ||
"[Institute of Communications Engineering (INT)](https://www.int.uni-rostock.de/),\n", | ||
"Faculty of Computer Science and Electrical Engineering (IEF),\n", | ||
"[University of Rostock, Germany](https://www.uni-rostock.de/en/),\n", | ||
"\n", | ||
"Tutorial Signal- und Systemtheorie (Course #24015),\n", | ||
"Summer Semester 2020\n", | ||
"\n", | ||
"**Introduction**\n", | ||
"\n", | ||
"Feel free to contact lecturer [frank.schultz@uni-rostock.de](https://orcid.org/0000-0002-3010-0294)\n", | ||
"\n", | ||
"- lecture: https://github.com/spatialaudio/signals-and-systems-lecture\n", | ||
"- tutorial: https://github.com/spatialaudio/signals-and-systems-exercises\n", | ||
"\n", | ||
"WIP...\n", | ||
"This [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) project is currently under heavy development while adding new material for the summer term 2020.\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"plt.figure(figsize=(10, 8))\n", | ||
"N = 2**12\n", | ||
"x = np.arange(-N, N)/(N//3)\n", | ||
"epsilon = [20, 10, 5, 2, 1]\n", | ||
"\n", | ||
"plt.subplot(2, 1, 1)\n", | ||
"for e in epsilon:\n", | ||
" y = np.ones_like(x) * e\n", | ||
" y[x < -1/(2*e)] = 0\n", | ||
" y[x > +1/(2*e)] = 0\n", | ||
" plt.plot(x, y, label=r'$\\epsilon=$ %d' % e, lw=2)\n", | ||
"plt.legend(loc='upper left')\n", | ||
"# plt.xlabel('x')\n", | ||
"plt.ylabel(r'$\\delta_\\epsilon(x) = \\epsilon \\cdot \\mathrm{rect}(x \\epsilon)$')\n", | ||
"plt.title(r'$\\delta_\\epsilon(x) = \\epsilon \\cdot \\mathrm{rect}(x \\epsilon)$')\n", | ||
"plt.xlim(-3, 3)\n", | ||
"plt.yticks(np.arange(0, 25+5, 5))\n", | ||
"plt.ylim(0, 21)\n", | ||
"plt.grid(True)\n", | ||
"\n", | ||
"x[x == 0] = 1e-16 # avoid div by 0\n", | ||
"plt.subplot(2, 1, 2)\n", | ||
"for e in epsilon:\n", | ||
" y = np.sin(e*x) / (np.pi*x)\n", | ||
" y[x == 0] = e / np.pi # correct result for x = 0, L'Hospital rule\n", | ||
" plt.plot(x, y, label=r'$\\epsilon=$ %d' % e, lw=2)\n", | ||
"plt.legend(loc='upper left')\n", | ||
"plt.xlabel('x')\n", | ||
"plt.ylabel(r'$\\delta_\\epsilon(x) = \\sin(\\epsilon x) \\, / \\, (\\pi x)$')\n", | ||
"plt.title(r'$\\delta_\\epsilon(x) = \\sin(\\epsilon x) \\, / \\, (\\pi x)$')\n", | ||
"plt.xlim(-3, 3)\n", | ||
"plt.yticks(np.arange(-2, 6+2, 2))\n", | ||
"plt.ylim(-2, 7)\n", | ||
"plt.grid(True)\n", | ||
"\n", | ||
"plt.savefig('D410BDAAE0.pdf')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Copyright\n", | ||
"\n", | ||
"The notebooks are provided as [Open Educational Resources](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebooks for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Frank Schultz, Signals and Systems - A Tutorial Featuring Computational Examples* with the github URL and commit number and/or version tag." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python [conda env:mypy] *", | ||
"language": "python", | ||
"name": "conda-env-mypy-py" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Prof. [Sascha Spors](https://orcid.org/0000-0001-7225-9992),\n", | ||
"Professorship Signal Theory and Digital Signal Processing,\n", | ||
"[Institute of Communications Engineering (INT)](https://www.int.uni-rostock.de/),\n", | ||
"Faculty of Computer Science and Electrical Engineering (IEF),\n", | ||
"[University of Rostock, Germany](https://www.uni-rostock.de/en/),\n", | ||
"\n", | ||
"Tutorial Signal- und Systemtheorie (Course #24015),\n", | ||
"Summer Semester 2020\n", | ||
"\n", | ||
"**Introduction**\n", | ||
"\n", | ||
"Feel free to contact lecturer [frank.schultz@uni-rostock.de](https://orcid.org/0000-0002-3010-0294)\n", | ||
"\n", | ||
"- lecture: https://github.com/spatialaudio/signals-and-systems-lecture\n", | ||
"- tutorial: https://github.com/spatialaudio/signals-and-systems-exercises\n", | ||
"\n", | ||
"WIP...\n", | ||
"This [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) project is currently under heavy development while adding new material for the summer term 2020.\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"\n", | ||
"def my_sinc(x): # we rather use definition sinc(x) = sin(x)/x, thus:\n", | ||
" return np.sinc(x/np.pi)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"T = 1 # signal period in s\n", | ||
"# max k in Fourier series\n", | ||
"K_des = [40, 40, 40, 40, 40] \n", | ||
"# signal high duration per period, <=T\n", | ||
"Th_des = [0.1*T, 0.2*T, 0.5*T, 0.8*T, T]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for idx, (K, Th) in enumerate(zip(K_des, Th_des)):\n", | ||
" print(idx, K, Th)\n", | ||
"\n", | ||
" A = 1/Th # such that sinc amplitude is always 1 for ck*T\n", | ||
"\n", | ||
" # Fourier series coefficients\n", | ||
" w0 = 2*np.pi/T\n", | ||
" k = np.arange(-K, K)\n", | ||
" tmp = w0 * k * Th/2\n", | ||
" ck = A*Th/T * my_sinc(tmp)\n", | ||
"\n", | ||
" # Fourier transform for single rect pulse\n", | ||
" w = w0 * np.linspace(-K, K, K*2**4, endpoint=True)\n", | ||
" X = A*Th * my_sinc(w*Th/2)\n", | ||
"\n", | ||
" # time vector\n", | ||
" fh = w0*K / (2*np.pi) # highest frequency in the signal\n", | ||
" fs = 10*fh # sampling frequency, >2*fh according to sampling theorem\n", | ||
" Ts = 1/fs # sampling period\n", | ||
" tmin = -2*T\n", | ||
" tmax = +2*T\n", | ||
" trange = tmax - tmin\n", | ||
" t = np.arange(np.int(trange/Ts))*Ts + tmin\n", | ||
"\n", | ||
" # Fourier series synthesis\n", | ||
" x = np.sum(ck[:, np.newaxis] *\n", | ||
" np.exp(+1j*w0*k[:, np.newaxis]*t[np.newaxis, :]), axis=0)\n", | ||
" print('imag of x must be around 1e-16 due to numerical precision errors',\n", | ||
" np.max(np.abs(np.imag(x)))) # very small, thus:\n", | ||
" x = np.real(x)\n", | ||
"\n", | ||
" plt.figure(figsize=(10, 4))\n", | ||
" plt.subplot(1, 2, 1)\n", | ||
" plt.plot(k, ck*T, 'C0o', label='Fourier coefficients')\n", | ||
" plt.plot(w*T/(2*np.pi), X, 'C7',\n", | ||
" label='Fourier transform of single impulse with $T_h$, $A$')\n", | ||
" plt.xlim(-K, +K)\n", | ||
" plt.xlabel(r'$k$, $\\omega T \\, / \\, (2\\pi)$')\n", | ||
" plt.ylabel(r'$T \\cdot c_k$')\n", | ||
" plt.title(r'Fourier series coefficients, %d$\\leq k \\leq $%d' % (-K, +K))\n", | ||
" plt.legend()\n", | ||
" plt.text(K/10, 0.9, r'$T=$%3.1f s, $T_h=$ %3.1f s, $A=$%3.1f' % (T, Th, A))\n", | ||
" plt.grid(True)\n", | ||
" plt.subplot(1, 2, 2)\n", | ||
" plt.plot(t, x)\n", | ||
" plt.xticks(np.arange(tmin, tmax+T/2, T/2))\n", | ||
" plt.xlim(tmin, tmax)\n", | ||
" plt.ylim(-1/5*A, 6/5*A)\n", | ||
" plt.xlabel(r'$t \\, / \\, s$')\n", | ||
" plt.ylabel(r'$x(t)$')\n", | ||
" plt.title(r'Fourier series synthesis, %d$\\leq k \\leq $%d' % (-K, +K))\n", | ||
" plt.grid(True)\n", | ||
" plt.savefig('D1483A84E2_'+str(idx)+'.pdf')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Copyright\n", | ||
"\n", | ||
"The notebooks are provided as [Open Educational Resources](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebooks for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Frank Schultz, Signals and Systems - A Tutorial Featuring Computational Examples* with the github URL and commit number and/or version tag." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python [conda env:mypy] *", | ||
"language": "python", | ||
"name": "conda-env-mypy-py" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
c.InlineBackend.figure_formats = {'svg', 'pdf'} | ||
c.InlineBackend.rc = {'font.size': 10, 'figure.dpi': 96} | ||
|
Oops, something went wrong.