Commit 2e78559e authored by Hafiz Emin Kosar's avatar Hafiz Emin Kosar
Browse files

- dynamically update y-lims in plots in Diskrete Faltung

parent 6acd1dba
......@@ -95,21 +95,26 @@
if container_s is None:
ax = axs0[0];
container_s = ient_stem(ax, m, s(m), 'rwth')
ax.set_xticks(np.arange(-10, 11, step=2))
ax.set_xlabel(r'$\rightarrow n$'); ax.set_ylabel(r'$\uparrow s(n)$')
ax.set_xlim([-10.9, 10.9]); ax.set_ylim([-.19, 1.19]); ient_axis(ax); ient_grid(ax);
ax.set_xlim([-10.9, 10.9]); ient_axis(ax); ient_grid(ax);
ient_update_ylim(ax, s(m), .19)
ax = axs0[1];
container_h = ient_stem(ax, m, h(m), 'rwth')
ax.set_xticks(np.arange(-10, 11, step=2))
ax.set_xlabel(r'$\rightarrow n$'); ax.set_ylabel(r'$\uparrow h(n)$')
ax.set_xlim(axs0[0].get_xlim()); ax.set_ylim(axs0[0].get_ylim()); ient_axis(ax); ient_grid(ax);
ax.set_xlim(axs0[0].get_xlim()); ient_axis(ax); ient_grid(ax);
ient_update_ylim(ax, s(m), .19)
else:
ient_stem_set_ydata(container_s, s(m))
ient_update_ylim(axs0[0], s(m), .19)
ient_stem_set_ydata(container_h, h(m))
ient_update_ylim(axs0[1], h(m), .19)
# Widgets
w_s_type=widgets.Dropdown(options=list(signal_types.keys()), description=r'Wähle $s(n)$:', style=ient_wdgtl_style)
w_s_n0=widgets.FloatSlider(min=-5, max=5, value=0, step=1, description=r'Verschiebung $n_0$', style=ient_wdgtl_style)
......@@ -151,11 +156,10 @@
ient_stem_set_ydata(container_hh, h(n-m))
ient_stem_set_ydata(container_gg, g_plot)
ax = axs[0]
ax.texts[0].set_x(n); ax.lines[3].set_xdata([n,n]) # update labels
ax = axs[1]
ient_update_ylim(ax, gn, 0.19, 20);
else:
ax = axs[0];
container_ss = ient_stem(ax, m, s(m), 'grun', label=r'$s(m)$')
container_ss[0].set_markerfacecolor('none');
......@@ -173,10 +177,13 @@
ax = axs[1]
ax.set_xlabel(r'$\rightarrow n$'); ax.set_ylabel(r'$\uparrow g(n)=s(n)\ast h(n)$');
ax.set_xlim(axs[0].get_xlim()); ient_update_ylim(ax, gn, 0.19, 20);
ax.set_xticks(np.arange(-10, 11, step=2))
ient_grid(ax); ient_axis(ax);
ient_update_ylim(axs[0], np.concatenate([s(m), h(n-m)]), .19)
ient_update_ylim(axs[1], gn, .19, ymax=1e3)
```
%% Cell type:markdown id: tags:
## Aufgaben
......
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