当我使用 linspace 为 a 和 b 值绘制图形并绘制它时,它是沿着轴而不是间隔绘制样本。例如:
a=np.linspace(0,5,100)
b=np.linspace(0,6,100)
绘制的是 a 和 b 的 0-100,而不是图表上的 0-5 和 0-6。有人可以帮忙吗
fig, ax = plt.subplots(1,1, figsize=(8,6), sharex=True)
a=np.linspace(0,5,1000)
b=np.linspace(0,6,1000)
def lyapunov(a,b):
a,b = np.meshgrid(a,b)
d = 0.3
xold = 0.5
yold = 0.01
ee = 0.
for k in range(1000):
xnew=f(a,b,xold,yold)
ynew=g(b,d,xold,yold)
xold = xnew
yold = ynew
ml=0
for l in range(10000):
ydash=1
ml = ml + np.log(abs(e(a,b,xold,yold,ydash)))
ydash = yz(a,b,xold,yold,ydash)
xold=f(a,b,xold,yold)
yold=g(b,d,xold,yold)
ml = (ml/(2*10000))
ml[np.isnan(ml)] = -0.5
return ml
z = lyapunov(a,b)
print(z)
ax.set_title('Lyapunov Exponent')
c = ax.pcolormesh(z)
fig.colorbar(c)
plt.show()