37,718
社区成员
发帖
与我相关
我的任务
分享
import numpy as np
from scipy.integrate import odeint
#函数定义
def test(w,t):
return t
t = np.arange(0,100,1)
track = odeint(test,0,t)
import matplotlib.pyplot as plt
plt.xlabel('Time[hour]')
plt.ylabel('Y')
plt.plot(t,track[:,0])
plt.show()
import numpy as np
from scipy.integrate import odeint
#这里做了个计数器来计算test函数执行次数
counter = 0
def test(w,t):
global counter
counter += 1
print(counter)
return t
t = np.arange(0,100,1)
track = odeint(test,0,t)
import matplotlib.pyplot as plt
plt.xlabel('Time[hour]')
plt.ylabel('Firing Rate[Hz]')
plt.plot(t,track[:,0])
plt.show()
import numpy as np
from scipy.integrate import odeint
counter = 0
def test(w,t):
global counter
counter += 1
print(counter)
return t+np.random.normal(0,0.05)
t = np.arange(0,100,1)
track = odeint(test,0,t)
import matplotlib.pyplot as plt
plt.xlabel('Time[hour]')
plt.ylabel('Firing Rate[Hz]')
plt.plot(t,track[:,0])
plt.show()