GDET3 Laplace-Transformation.ipynb 5.59 KB
Newer Older
1
2
3
4
5
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
6
7
8
9
10
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
11
12
   "outputs": [],
   "source": [
13
    "# Copyright 2020 Institut für Nachrichtentechnik, RWTH Aachen University\n",
14
    "%matplotlib widget\n",
15
    "from ipywidgets import interact, interactive, fixed, HBox, VBox\n",
16
17
18
19
    "import ipywidgets as widgets\n",
    "from IPython.display import clear_output, display, HTML\n",
    "from IPython.display import Markdown as md\n",
    "\n",
20
    "from ient_nb.ient_plots import *\n",
21
    "from ient_nb.ient_signals import *\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
22
    "from ient_nb.ient_transforms import *\n",
23
    "\n",
24
25
26
27
    "from src.laplace.laplace_plot import pzPoint, pzPlot\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.gridspec as gridspec\n",
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    "import numpy as np\n",
    "\n",
    "t = np.linspace(-6,6,1024)\n",
    "f = np.linspace(-6,6,1024)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div>\n",
    "    <img src=\"ient_nb/figures/rwth_ient_logo@2x.png\" style=\"float: right;height: 5em;\">\n",
    "</div>\n",
    "\n",
    "# Laplace-Transformation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Beispiele\n",
    "\n",
    "$s_1(t) = \\mathrm{e}^{-bt}\\cdot\\epsilon(t)$ \n",
    "transformiert sich zu\n",
    "$S_1(p) = \\frac{1}{b+p}$ mit Konvergenzbereich $\\mathrm{Re}\\{p\\}>\\mathrm{Re}\\{-b\\}$"
54
55
56
57
58
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
59
   "metadata": {},
60
61
   "outputs": [],
   "source": [
62
63
64
65
    "b = 2\n",
    "pp = np.array([-b]); pz = np.array([])\n",
    "roc = np.array([-b, np.inf])\n",
    "\n",
66
    "fig,axs = plt.subplots(1,2, **ient_landscape)\n",
67
    "# Laplace-Bereich\n",
68
    "ax = axs[0]; ient_plot_lroc(ax, roc)\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
69
    "ax.plot(np.real(pp), np.imag(pp), **ient_style_poles); ax.plot(np.real(pp), -np.imag(pp), **ient_style_poles)\n",
70
71
72
73
    "ax.set_xlabel(r'$\\rightarrow \\mathrm{Re}$'); ax.set_ylabel(r'$\\uparrow \\mathrm{Im}$');\n",
    "ax.set_xlim(-5, 5); ax.set_ylim(-5, 5); ient_grid(ax); ient_axis(ax)\n",
    "\n",
    "# Zeitbereich\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
74
    "s1, _, _ = ient_ilaplace_ht(t, 1, pp, pz, [1], [], roc)\n",
75
    "ax = axs[1]; ax.plot(t, np.real(s1), **ient_style_graph); \n",
76
77
78
79
80
81
82
    "ax.set_xlabel(r'$\\rightarrow t$'); ax.set_ylabel(r'$\\uparrow s_1(t)$'); ient_grid(ax); ient_axis(ax)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
83
    "Da der Konvergenzbereich die imaginäre Achse umschließt, existiert auch die Fouriertransformierte $S_1(f)$:"
84
85
86
87
88
89
90
91
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
92
    "# Frequenzbereich\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
93
    "S1f = ient_ilaplace_Hf(f, 1, pp, pz, [1], [], dB=False)\n",
94
95
96
97
98
99
100
101
102
103
104
105
    "fig, ax = plt.subplots(1,1)\n",
    "ax.plot(f, S1f, **ient_style_graph); \n",
    "ax.set_xlabel(r'$\\rightarrow f$'); ax.set_ylabel(r'$\\uparrow S_1(f)$');\n",
    "ax.set_xlim([-5.5,5.5]); ax.set_ylim([-0.1,0.55]); ient_grid(ax); ient_axis(ax)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$s_2(t) = -\\mathrm{e}^{-bt}\\cdot\\epsilon(-t)$ \n",
    "transformiert sich zu \n",
106
    "$S_2(p) = \\frac{1}{b+p}$ mit Konvergenzbereich $\\mathrm{Re}\\{p\\}<\\mathrm{Re}\\{-b\\}$:"
107
108
109
110
111
112
113
114
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
115
    "roc = np.array([-np.inf, -b])\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
116
    "\n",
117
    "fig,axs = plt.subplots(1,2, **ient_landscape)\n",
118
    "# Laplace-Bereich\n",
119
    "ax = axs[0]; ient_plot_lroc(ax, roc); ient_annotate_order(ax, pp, [1]);\n",
120
121
122
123
124
    "ax.plot(np.real(pp), np.imag(pp), **ient_style_poles); ax.plot(np.real(pp), -np.imag(pp), **ient_style_poles)\n",
    "ax.set_xlabel(r'$\\rightarrow \\mathrm{Re}$'); ax.set_ylabel(r'$\\uparrow \\mathrm{Im}$');\n",
    "ax.set_xlim(-5, 5); ax.set_ylim(-5, 5); ient_axis(ax); ient_grid(ax)\n",
    "\n",
    "# Zeitbereich\n",
Hafiz Emin Kosar's avatar
Hafiz Emin Kosar committed
125
    "s2, _, _ = ient_ilaplace_ht(t, 1, pp, pz, [1], [], roc)\n",
126
127
128
    "ax = axs[1]; ax.plot(t, np.real(s2), **ient_style_graph); \n",
    "ax.set_xlabel(r'$\\rightarrow t$'); ax.set_ylabel(r'$\\uparrow s_2(t)$'); \n",
    "ax.set_ylim([-45,5]); ax.grid(); ient_axis(ax)"
129
130
   ]
  },
131
132
133
134
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Iris Heisterklaus's avatar
Iris Heisterklaus committed
135
136
137
138
    "Da in diesem Fall der Konvergenzbereich links vom linkesten Pol liegt und somit nicht die imaginäre Achse beinhaltet, existiert die Fouriertransformierte nicht. \n",
    "\n",
    "\n",
    "Eine ausführlichere Demo zur Laplacetransformation findet man [hier](GDET3%20Laplace-Transformation%20GUI.ipynb)."
139
140
   ]
  },
141
142
  {
   "cell_type": "markdown",
143
   "metadata": {},
144
   "source": [
145
    "___\n",
146
147
148
    "This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources) (OER). Feel free to use the notebook for your own purposes. The code is licensed under the [MIT license](https://opensource.org/licenses/MIT). \n",
    "\n",
    "Please attribute the work as follows: \n",
149
    "*Emin Kosar, Christian Rohlfing, Übungsbeispiele zur Vorlesung \"Grundgebiete der Elektrotechnik 3 - Signale und Systeme\"*, gehalten von Jens-Rainer Ohm, 2020, Institut für Nachrichtentechnik, RWTH Aachen University."
150
   ]
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
169
   "version": "3.8.1"
170
171
172
  }
 },
 "nbformat": 4,
173
 "nbformat_minor": 4
174
}