这里,我有一个参数方程。在
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
t = np.linspace(0,2*np.pi, 40)
# Position Equation
def rx(t):
return t * np.cos(t)
def ry(t):
return t * np.sin(t)
# Velocity Vectors
def vx(t):
return np.cos(t) - t*np.sin(t)
def vy(t):
return np.sin(t) + t*np.cos(t)
# Acceleration Vectors
def ax(t):
return -2*np.sin(t) - t*np.cos(t)
def ay(t):
return 2*np.cos(t) - t*np.sin(t)
fig = plt.figure()
ax1 = fig.gca(projection='3d')
z = t
ax1.plot(rx(z), ry(z), z)
plt.xlim(-2*np.pi,2*np.pi)
plt.ylim(-6,6)
#ax1.legend() # no labels
plt.show()
所以我有一个参数方程来创建这个图。在
我在上面的代码中定义了速度和加速度参数方程。在
我想做的是在我上面的位置图中,在定义的点上绘制加速度和速度向量。(内径est,t=pi/2,3pi/2,2pi)
像这样:
Plotting a 3d cube, a sphere and a vector in Matplotlib
但是我想做更直接的事情,因为我必须把每个点t定义成两个方程。在
这样的事情有可能吗?我只能找到向量场什么的。在
谢谢。在
编辑问题
^{pr2}$它会给我一个错误说Tuple out of index
我觉得这很近。。。甚至有与样品图片相匹配的颜色:)
不过,我对极坐标绘图没有太多的经验(主要是在三维
t
坐标上感到困惑)。在希望这会有帮助,你可以想出如何扩展它
我获取了您所拥有的,从this answer添加了}中的一些示例值上添加了一个简单的for循环。在
Arrow3D
类,并在{^{pr2}$
相关问题 更多 >
编程相关推荐