Commit cc8ecfbc authored by Christian Rohlfing's avatar Christian Rohlfing
Browse files

- introduced ient_landscape to some notebooks (not all, to be checked!)

- rearanged zeitverschiebung a little bit
parent 89302350
Pipeline #235178 passed with stages
in 17 minutes and 24 seconds
......@@ -67,11 +67,11 @@
'Versch. Rechteck' : lambda t: -rect(t-0.5),
'Eigene Kreation s0(t)' : s_0,
}
# Plot
fig0, axs0 = plt.subplots(1, 2, figsize=(8,2))
fig0, axs0 = plt.subplots(1, 2, figsize=(12,2))
def update_signals(s_type, s_T, s_t0, h_type, h_T, h_t0):
global s, h, gt # reused in second interactive plot
s = lambda tau: signal_types[s_type]((tau-s_t0)/s_T);
h = lambda tau: signal_types[h_type]((tau-h_t0)/h_T);
gt = convolution(s, h) # numerical convolution
......@@ -111,11 +111,11 @@
... und betrachte hier das Faltungsergebnis:
%% Cell type:code id: tags:
``` python
fig, axs = plt.subplots(2, 1, figsize=(8,6),) # gridspec_kw = {'width_ratios':[3, 1]}
fig, axs = plt.subplots(2, 1, figsize=(12, 12/ient_fig_aspect)) # gridspec_kw = {'width_ratios':[3, 1]}
@widgets.interact(t=widgets.FloatSlider(min=-4, max=4, value=-2, step=.1, description='Verschiebung $t$', style=ient_wdgtl_style),
show_integrand=widgets.Checkbox(value=True, description='Zeige Integrand', style=ient_wdgtl_style))
def update_plot(t, show_integrand=True):
t_ind = np.where(tau>=t); t_ind = t_ind[0][0]; g_plot = gt.copy(); g_plot[t_ind:] = np.nan; # hide g(t') with t'>t
sh = s(tau)*h(t-tau) # integrand
......
......@@ -96,11 +96,11 @@
Über den letzten Schieberegler kann das Signal-zu-Rausch-Verhältnisse (SNR) eingestellt werden.
%% Cell type:code id: tags:
``` python
fig,axs = plt.subplots(2,2, figsize=(8,6), gridspec_kw = {'width_ratios':[2, 1]})
fig,axs = plt.subplots(2,2, **ient_landscape, gridspec_kw = {'width_ratios':[2, 1]})
Twdgt = widgets.FloatSlider(min=1, max=20, value=10, step=1, description=r'Periode T', style=ient_wdgtl_style)
Dwdgt = widgets.FloatSlider(min=0.5, max=10, value=5, step=.5, description=r'Dauer D', style=ient_wdgtl_style)
def update_x_range(*args):
Dwdgt.max = Twdgt.value
......
......@@ -43,11 +43,11 @@
``` python
b = 2
pp = np.array([-b]); pz = np.array([])
roc = np.array([-b, np.inf])
fig,axs = plt.subplots(1,2)
fig,axs = plt.subplots(1,2, **ient_landscape)
# Laplace-Bereich
ax = axs[0]; ient_plot_lroc(ax, roc)
ax.plot(np.real(pp), np.imag(pp), **ient_style_poles); ax.plot(np.real(pp), -np.imag(pp), **ient_style_poles)
ax.set_xlabel(r'$\rightarrow \mathrm{Re}$'); ax.set_ylabel(r'$\uparrow \mathrm{Im}$');
ax.set_xlim(-5, 5); ax.set_ylim(-5, 5); ient_grid(ax); ient_axis(ax)
......@@ -82,11 +82,11 @@
%% Cell type:code id: tags:
``` python
roc = np.array([-np.inf, -b])
fig,axs = plt.subplots(1,2)
fig,axs = plt.subplots(1,2, **ient_landscape)
# Laplace-Bereich
ax = axs[0]; ient_plot_lroc(ax, roc); ient_annotate_order(ax, pp, [1]);
ax.plot(np.real(pp), np.imag(pp), **ient_style_poles); ax.plot(np.real(pp), -np.imag(pp), **ient_style_poles)
ax.set_xlabel(r'$\rightarrow \mathrm{Re}$'); ax.set_ylabel(r'$\uparrow \mathrm{Im}$');
ax.set_xlim(-5, 5); ax.set_ylim(-5, 5); ient_axis(ax); ient_grid(ax)
......
......@@ -144,11 +144,11 @@
Durch Klicken kann das Histogram der aktuellen Musterfunktion zusätzlich zur Verteilungsdichtefunktion angezeigt werden.
%% Cell type:code id: tags:
``` python
fig, axs = plt.subplots(2, 2, figsize=(8,6), gridspec_kw = {'width_ratios':[3, 1]}); global ps, Ps;
fig, axs = plt.subplots(2, 2, **ient_landscape, gridspec_kw = {'width_ratios':[3, 1]}); global ps, Ps;
def update_plot(sig, ms, sigmas, F, show_hist):
global ps, Ps
# Sample from given distribution
if sig == 'Gauß-verteilt':
s = np.random.normal(ms, sigmas, len(t));
......
......@@ -25,17 +25,23 @@
gewählt. Hierbei steht $t_0$ für die Verschiebung des Signals, $T$ für die Dehnung/Stauchung und $\pm$ beschreibt die Spiegelung.
Das Ausgangssignal ist
$s(t) = t \cdot \mathrm{rect}\left(t-\frac{1}{2}\right)$.
%% Cell type:code id: tags:
``` python
s = lambda t: t*rect(t - 0.5)
```
%% Cell type:markdown id: tags:
Mit den Schiebereglern können unterschiedliche Werte für den Dehnungsfaktor $T$ und die Zeitverschiebung $t_0$ ausgewählt werden. Die Spiegelung kann über den entsprechenden Button ein- und ausgeschaltet werden.
%% Cell type:code id: tags:
``` python
s = lambda t: rect(t-0.5)*t
# Plot & demo
fig, ax = plt.subplots(1, 1, figsize=(8, 4))
@widgets.interact(T=widgets.FloatSlider(min=-4, max=4, value=1, step=.1, description=r'Dehnung $T$', style=ient_wdgtl_style),
t0=widgets.FloatSlider(min=-2, max=2, value=0, step=.1, description=r'Verschiebung $t_0$', style=ient_wdgtl_style),
reflection=widgets.Checkbox(value=False, description='Spiegelung', style=ient_wdgtl_style))
......
......@@ -323,7 +323,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.1"
}
},
"nbformat": 4,
......
......@@ -38,11 +38,11 @@
(t, deltat) = np.linspace(0, len(s)/fs, len(s), retstep=True) # time axis in seconds
S, f = ient_dft(s, fs) # Fourier transform
# Plot
fix, axs = plt.subplots(2,1)
fix, axs = plt.subplots(2,1, **ient_landscape)
ax = axs[0]; ax.plot(t, s, 'rwth'); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow s(t)$', bbox=ient_wbbox);
ax = axs[1]; ax.plot(f/1000, np.abs(S), 'rwth'); ient_axis(ax); ax.set_xlim([-7.5, 7.5]);
ax.set_xlabel(r'$\rightarrow f$ [kHz]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow |S(f)|$');
ient_audio_play(s, fs, r'$s(t)$')
......@@ -77,11 +77,11 @@
``` python
s_tilde = ient_filter(s, b, a)
# Plot
fig,axs = plt.subplots(2,1); ax = axs[0]; ax.plot(t, s_tilde, 'rwth'); ient_axis(ax);
fig,axs = plt.subplots(2,1, **ient_landscape); ax = axs[0]; ax.plot(t, s_tilde, 'rwth'); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow \tilde{s}(t)$', bbox=ient_wbbox);
S_tilde, f = ient_dft(s_tilde, fs);
ax = axs[1]; ax.plot(f/1000, np.abs(S_tilde), 'rwth'); ax.set_xlim([-7.5, 7.5]); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow f$ [kHz]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow |\tilde{S}(f)|$');
ient_audio_play(s_tilde, fs, r'$\tilde{s}(t)$')
......@@ -117,11 +117,11 @@
Die nächste Abbildung zeigt das gesamte Zeitsignal $m(t)$ und dessen Spektrum $M(f)$. Der Effekt der Modulation ist im Spektrum deutlich zu erkennen. Wo zuvor die Komponenten im niederfrequenten Bereich lagen, sind nun zwei verschobene Spektren zu erkennen, die sich bei der Trägerfrequenz $f_0=6\,\mathrm{kHz}$ befinden. Hört man sich nun das Sprachsignal an, ist vom Original nur noch wenig zu hören, da sich die Information nun im höherfrequenten Bereich befindet. Um das Originalsignal zurückzugewinnen, muss es demoduliert und damit wieder in den niederfrequenten Bereich verschoben werden.
%% Cell type:code id: tags:
``` python
fig,axs = plt.subplots(2,1); ax = axs[0]; ax.plot(t, m, 'rwth'); ient_axis(ax);
fig,axs = plt.subplots(2,1, **ient_landscape); ax = axs[0]; ax.plot(t, m, 'rwth'); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow m(t)$');
M, f = ient_dft(m, fs); ax = axs[1]; ax.plot(f/1000, np.abs(M), 'rwth'); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow f$ [kHz]'); ax.set_ylabel(r'$\uparrow |M(f)|$'); ax.set_xlim([-12,12])
ient_audio_play(m, fs, r'$m(t)$')
```
......@@ -175,18 +175,18 @@
m_T, m_plus = calculate_eq_lp(m, f0); m_T = np.real(m_T);
M_T, f = ient_dft(m_T, fs); M_plus,_ = ient_dft(m_plus, fs);
# Plot
fig,axs = plt.subplots(2,1);
fig,axs = plt.subplots(2,1, **ient_landscape);
ax = axs[0]; ax.plot(f/1000, np.abs(M_plus), 'rwth'); ient_axis(ax); ax.set_title('Rechtsseitiges Spektrum')
ax.set_xlabel(r'$\rightarrow f$ [kHz]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow |M_+(f)|$');
ax = axs[1]; ient_axis(ax); ax.set_title('Analytische Komponente')
ax.plot(t, np.real(m_plus), 'rwth', label=r'$\mathrm{Re}\{m_+(t)\}$'); ax.plot(t, np.imag(m_plus), 'grun', label=r'$\mathrm{Im}\{m_+(t)\}$');
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox); ax.legend();
fig,axs = plt.subplots(2,1); ax = axs[0]; ax.plot(t, m_T, 'rwth'); ient_axis(ax); ax.set_title('Äquivalentes Tiefpasssignal')
fig,axs = plt.subplots(2,1, **ient_landscape); ax = axs[0]; ax.plot(t, m_T, 'rwth'); ient_axis(ax); ax.set_title('Äquivalentes Tiefpasssignal')
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow m_\mathrm{T}(t)$', bbox=ient_wbbox);
ax = axs[1]; ax.plot(f/1000, np.abs(M_T), 'rwth'); ient_axis(ax);
ax.set_xlabel(r'$\rightarrow f$ [kHz]', bbox=ient_wbbox); ax.set_ylabel(r'$\uparrow |M_\mathrm{T}(f)|$');
ient_audio_play(m_T, fs, r'$m_\mathrm{T}(t)$')
......@@ -202,11 +202,11 @@
%% Cell type:code id: tags:
``` python
# Plot
fig, axs = plt.subplots(2, 1);
fig, axs = plt.subplots(2, 1, **ient_landscape);
ax = axs[0]; ax.plot(t, m, 'rwth', label=r'$m(t)$');
ax.plot(t, np.abs(m_T), 'grun', label=r'$|m_\mathrm{T}(t)|$');
ax.set_xlabel(r'$\rightarrow t$ [s]', bbox=ient_wbbox);
ax.legend(); ient_axis(ax);
......
File mode changed from 100644 to 100755
Subproject commit 9e49e834a0193e41d36cb645485044ba1928428b
Subproject commit 0e50f13a97ece684661be60288bb08a4d0153907
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment