Simple Signal Translation class working

This commit is contained in:
Eric Teunis de Boone 2022-01-11 10:45:42 +01:00
parent 8573449aa6
commit ae7aba6266
2 changed files with 435 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -150,7 +150,31 @@
"execution_count": null, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": [
"# animation\n",
"fig = plt.figure()\n",
"plt.suptitle(\"Travelling sine wave\")\n",
"ax = fig.add_subplot(111,projection='3d')\n",
"ax.set_xlabel(\"spatial distance\")\n",
"ax.set_ylabel('temporal distance')\n",
"ax.set_zlabel(\"amplitude\")\n",
"l1 = ax.plot(x[0], t[0], signal(x[0], t[0], velocities), label='right moving')\n",
"l2 = ax.plot(x[0], t[0], signal(x[0], t[0], velocities[::-1]), label='left moving')\n",
"l3 = ax.plot(x[0], t[0], signal(x[0], t[0], 1), label='flat line')\n",
"\n",
"lines = [l1, l2, l3]\n",
"\n",
"def update(i, fig, ax):\n",
" ax.view_init(elev=20., azim=i)\n",
" \n",
" \n",
" ax.legend()\n",
" return fig, ax\n",
" \n",
"anim = FuncAnimation(fig, update, frames=np.arange(0, 360, 2), repeat=True, fargs=(fig, ax))\n",
"anim.save('rgb_cube.gif', dpi=80, writer='imagemagick', fps=24)\n",
"plt.show();"
]
} }
], ],
"metadata": { "metadata": {