簡體   English   中英

如何計算速度的相空間並在python中繪制散點圖?

[英]how to calculate phase space of velocity and draw a scatter plot in python?

我有一個時間序列速度的向量。 例如 :

u=[100,120,150,115,130,115,105,103,108,132,135,121]

現在我需要計算 Δu,然后繪制散點圖。 類似於下圖。 我怎樣才能做到這一點?

在此處輸入圖片說明

import numpy as np
import matplotlib.pyplot as plt

u = np.array([100,120,150,115,130,115,105,103,108,132,135,121])
du = u[1:] - u[:-1] # the difference between the current and the prior velocity

plt.scatter(u[1:],du)
plt.show()

假設Δu = u[i] - u[i-1] ,很明顯你應該對u[1:]使用這個公式。 所以只需簡單地使用這些代碼行:

from numpy import array
import matplotlib.pyplot as plt

u = aray(u)
del_u = u[1:] - u[:-1] # This line let you use that formula for all numbers in array except first one.
plt.scatter(u[1:], del_u)
plt.show()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM