绘制没显示

飞雷神面包

1 回复8 浏览

来自课程:人工智能中的数学基础(Python)

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

def PxFun(x, y):
    return 1 + 4*x + 2*y
def PyFun(x, y):
    return 1 - 2*x + 4*y
def Fun(x, y):
    return x-y+2*x*x+2*x*y+y*y

fig = plt.figure()
ax = Axes3D(fig)
X, Y = np.mgrid[-2:2:40j, -2:2:40j]
Z = Fun(X, Y)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap="rainbow")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")
plt.show()

全部回复(1)

  • 老师_Sky 1 楼

    同学在A计划班级群里问一下哈~

发表回复

登录后可以回复