霍夫分叉图

问题描述 投票:2回答:1

我正在尝试对分叉图进行编码,以说明Oregonator模型产生振荡行为的f的值。我在resolve_ivp行出现“设置带有序列的数组元素”错误。我怀疑这与时间有关,但是我不确定。我应该得到霍普夫分叉,即在振荡区域中的子弹状圆锥。

这里是代码:

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp

# Dimensionless constant parameters
eps = 0.04
a = 0.0008

# Dimensionless varying parameter - will reveal limit cycle region
f = np.linspace(-5,5,250)

# Oregonator model
def Oregonator(t, Y):
    x,z = Y;
    return [(x * (1 - x) + ((a - x) * f * z) / (a + x)) / eps, x - z]

# Time span, initial conditions

ts = np.linspace(-5, 5, 250)
Y0 = [1, 0.5]


# Numerical algorithm/method
NumSol = solve_ivp(Oregonator, [0, 30], Y0, method="Radau")
t = NumSol.t
x,z = NumSol.y

# Plot
fig = plt.figure()
ax = fig.gca(projection='3d')


ax.plot(f, x, z, 'm')
ax.set_xlabel('$f$', fontsize=10)
ax.set_ylabel('$x^*$', fontsize=10)
ax.set_zlabel('$z^*$', fontsize=10)

ax.axis([-5, 5, -5, 5])
plt.grid()
plt.show() 
python numpy ode nonlinear-functions chemistry
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.