我尝试使用Python实现Chua系统。但是图表和我们需要的有很大的不同。用这样的系统实现

我没有在互联网上找到任何地方,我试着自己去做。但在python中,我仍然没有什么经验。
我得到的是:

我需要的是:

import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
a,b,e,x2=2.8,3,0.03,9
def f(y, t):
y1, y2, y3 = y
return [(-a/b)*(y2-y1),
(-1/b)*((y2-y1)+y3)+(e/b)*(x2-y2),
(b*y2)]
t = np.linspace(0,20,2001)
y0 = [1, -1, 10]
[y1,y2,y3]=odeint(f, y0, t, full_output=False).T
fig = plt.figure(facecolor='white')
ax=Axes3D(fig)
ax.plot(y1,y2,y3,linewidth=2)
plt.xlabel('y1')
plt.ylabel('y2')
plt.title("primary: y0 = [1, -1, 10]")
y0 = [1.0001, -1, 10]
[y1,y2,y3]=odeint(f, y0, t, full_output=False).T
fig = plt.figure(facecolor='white')
ax=Axes3D(fig)
ax.plot(y1,y2,y3,linewidth=2)
plt.xlabel('y1')
plt.ylabel('y2')
plt.title("primary: y0 = [1.0001, -1, 10]")
plt.show()发布于 2020-04-15 03:00:13
因为我不太了解Chua的振荡器,除非我弄错了,否则我确实认为你的ODE系统定义中有一个错误。
简单的基于Chua's circuit的维基百科英文页面。你似乎没有提供描述非线性电阻电响应的函数f的表达式。因此,从给定的f等式和表达式开始,下面是我使用odeint的尝试
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# parameters
alpha = 15.395
beta = 28
R = -1.143
C_2 = -0.714
def chua(u, t):
x, y, z = u
# electrical response of the nonlinear resistor
f_x = C_2*x + 0.5*(R-C_2)*(abs(x+1)-abs(x-1))
dudt = [alpha*(y-x-f_x), x - y + z, -beta * y]
return dudt
# time discretization
t_0 = 0
dt = 1e-3
t_final = 300
t = np.arange(t_0, t_final, dt)
# initial conditions
u0 = [0.1,0,0]
# integrate ode system
sol = odeint(chua, u0, t)
# 3d-plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.plot(sol[:,0],sol[:,1],sol[:,2])这给出了3D中预期的混沌行为:

这是x-y平面上的时间演化:

希望这有助于用你自己的参数集解决你的问题。
https://stackoverflow.com/questions/61127919
复制相似问题