import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
z=np.arange(15,200)*10
x=np.arange(15,200)*10
x,z=np.meshgrid(x,z)
E=1/np.sqrt(x**2+z**2)*np.cos(2*np.pi*np.sqrt(x**2+z**2)/532)
fig=plt.figure()
ax=Axes3D(fig)
ax.plot_surface(x,z,E)
plt.show()
# import numpy as np
# import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
# z = np.arange(15,200)*10 #单位为nm
# x = np.arange(15,200)*10
# x,z = np.meshgrid(x,z) #创建坐标系
# E = 1/np.sqrt(x**2+z**2)*np.cos(2*np.pi*np.sqrt(x**2+z**2)/(532*1e-9))
# fig = plt.figure()
# ax = Axes3D(fig)
# ax.plot_surface(x,z,E)
# plt.show()
image.png
import nump