我想绘制达芬奇振荡器的庞加莱图。我绘制了t vs x曲线,其中x是给定振荡器方程的解。要绘制庞加莱图,我需要存储以2 * pi为间隔出现的那些x值。谁能帮我这个?我用scipy的odeint来解决这个问题。
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def mod(r,t):
w0 = -1
b = 1
a = 0.5
w = 1
f = 0.33
x = r[0]
dx = r[1]
rdot = [[],[]]
rdot[0] = dx
rdot[1] = f*np.sin(w*t) - a*dx - x*w0 - b*x**3
return rdot
r0 = [0,-1]
t = np.arange(0,20,2*np.pi)
sol = odeint(mod,r0,t)