下記のプログラムで、距離計算をしてbase_pointの何番目の距離を出しているか取得したいのですが、方法を教えてください。
if name == 'main':
points = np.random.rand(2,2)
base_points = np.random.rand(3,2)
plt.plot(points[:,0],points[:,1],'.',color='red')
plt.plot(base_points[:,0],base_points[:,1],'.',color='blue')
# 距離計算 for base_point in base_points: for point in points: distance = np.linalg.norm(base_point-point) print(distance) print('何番目の要素の距離です')
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。