python 绘制 3D 曲面

绘制如下系统的相图:
z = sin ( x 2 + y 2 ) z = \sin(\sqrt{x^2 + y^2})

from pylab import *
from mpl_toolkits.mplot3d import Axes3D

x, y = meshgrid(arange(-5, 5.5, 0.05), arange(-5, 5.5, 0.05))
z = sin(sqrt(x**2 + y**2))

ax = gca(projection='3d')

ax.plot_surface(x, y, z)

show()

在这里插入图片描述

等值线

cp = contour(x, y, z)
clabel(cp)

show()

在这里插入图片描述

原创文章 338 获赞 621 访问量 50万+

猜你喜欢

转载自blog.csdn.net/itnerd/article/details/105320807