群星增加纳米机器人代码 - import numpy as np
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# 参数设置
n = 100 # 群星数量 拼多多帮助力入口
r = 1.0 # 群星半径
a = 1.0 # 群星速度
t = np.linspace(0, 2*np.pi, n) # 时间
# 生成群星位置
positions = r * np.sin(t) + a * np.cos(t)
# 绘制群星
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(positions[:, 0], positions[:, 1], positions[:, 2], 'b-')
ax.set_xlabel('X轴')
ax.set_ylabel('Y轴')
ax.set_zlabel('Z轴')
plt.show()