如何使用python的z函数在matplotlib中创建表面图

问题描述 投票:0回答:1

我具有z的功能:

z = 0.4x + 0.7y + 0.8x ^ 2 + 0.5xy + 0.2y ^ 2

(-3

是否有一种方法可以在python中使用matplotlib绘制x,y,z的3d表面图解图?

python-3.x matplotlib 3d surface
1个回答
0
投票

Sympy,Python的符号数学库,包含函数plot3d_parametric_surface。 Sympy的绘图内部使用matplotlib。请注意,Python使用plot3d_parametric_surface进行幂运算,因为**保留用于^

exclusive or

from sympy.plotting.plot import plot3d_parametric_surface from sympy.abc import x, y plot3d_parametric_surface(x, y, 0.4 * x + 0.7 * y + 0.8 * x ** 2 + 0.5 * x * y + 0.2 * y ** 2, (x, -3, 3), (y, -3, 3))

© www.soinside.com 2019 - 2024. All rights reserved.