2

Im trying to make a 3d animation of a 2d wave propagating in python, with z-axis the amplitude of electric field of the wave. x and y is a grid at which points the amplitude is measured at time t so EzTot is a 3d array with the values of amplitude for t = 0,..,500 (amplitude at (x,y) in the grid at time t is given by EzTot[t][x,y]). I would like to animate this amplitude from time 0 to 500 but i don't know how. Below you can see the code for a 3d surface plot of the wave amplitude at time 500.

y = range(NY)
z = EzTot[500]
fig = plt.figure()
ax = Axes3D(fig)
x, y = np.meshgrid(x, y)
ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap='hot') ```
plt.show

0 Answers0