我想生成陈的超混沌序列。公式如下:Chen 的超混沌序列方程
附上我写的代码。
import math
a = 36
b = 3
c = 28
d = 16
k = 0.2
def chen(x0, y0, z0, q0):
xdot = a * (y0 - x0)
ydot = (-x0 * z0) + (d * x0) + (c * y0) - q0
zdot = (x0 * y0) - (b * z0)
qdot = x0 + k
return xdot, ydot, zdot, qdot
def chaotic_seq(x0, y0, z0, q0, length):
for i in range(length):
xdot, ydot, zdot, qdot = chen(x0, y0, z0, q0)
if math.isnan(xdot) or math.isnan(ydot) or math.isnan(zdot) or math.isnan(qdot):
print(i)
x0 = xdot
y0 = ydot
z0 = zdot
q0 = qdot
if __name__ == '__main__':
x0 = 0.3
y0 = -0.4
z0 = 1.2
q0 = 1
length = 2048
chaotic_seq(x0=x0, y0=y0, z0=z0, q0=q0, length=length)
我面临的问题是,在“i=11”之后,所有值(xdot、ydot、zdot、qdot)都是 NaN。