【发布时间】:2020-06-02 13:18:14
【问题描述】:
我有一个抛射运动
y0 = [0., 0., 15 * np.cos(alpha), 15 * np.sin(alpha)]
time = np.linspace(0, 5, num=10000)
res = ode.odeint(func, y0, time)
要删除 y-axis 的负值,我使用
yy = np.delete(res[:, 1], np.where(res[:, 1] < 0)[0], axis=0)
但是如何改变
res[:, 0] = # xaxes
res[:, 2] = # velocity x-direction
res[:, 3] = # velocity y direction
更改后与y-axis 相同的长度/大小数组?
【问题讨论】:
-
没有办法直接做到这一点。应该保存已删除的索引,然后使用该索引列表将其删除到 x 数组中。
标签: python physics numpy-ndarray