# 绘制函数f(x,y)=sin(sqrt(x**2+y**2)/sqrt(x**2+y**2) import matplotlib.pyplot as plt import math import numpy as np from mpl_toolkits.mplot3d import Axes3D fig = plt.figure(figsize=(12, 6)) ax = Axes3D(fig) X, Y = np.mgrid[-20:20:50j, -20:20:50j] Z = np.sin(np.sqrt(X ** 2 + Y ** 2)) / np.sqrt(X ** 2 + Y ** 2) surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=plt.get_cmap('rainbow')) ax.set_zlim(0.5, 1) ax.set_xlabel('X') ax.set_zlabel('Y') ax.set_zlabel('Z') plt.title('$sin(sqrt(x^2+y^2))/sqrt(x^2+y^2)$') # plt.title('$sin(sqrt(x^2+y^2))/sqrt(x ^ 2+y ^ 2)$') plt.savefig('D:\Study', dpi=600) # 保存图片的路径 plt.show()
绘制函数f(x,y)=sin(sqrt(x**2+y**2)/sqrt(x**2+y**2)
最新推荐文章于 2024-08-14 12:00:04 发布