在曲線擬合/優化上有一個問題。我有三個偶聯的ODE,它們描述了消失底物和兩種產物形成的生化反應。我發現了一些幫助我創建代碼來解決ODE的例子(如下)。現在我想優化未知速率常數(k,k3和k4)以適應實驗數據P,這是來自產品y的信號[1]。這樣做最簡單的方法是什麼? 謝謝。曲線擬合耦合ODEs
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# Experimental data
P = [29.976,193.96,362.64,454.78,498.42,517.14,515.76,496.38,472.14,432.81,386.95,
352.93,318.93,279.47,260.19,230.92,202.67,180.3,159.09,137.31,120.47,104.51,99.371,
89.606,75.431,67.137,58.561,55.721]
# Three coupled ODEs
def conc (y, t) :
a1 = k * y[0]
a2 = k2 * y[0]
a3 = k3 * y[1]
a4 = k4 * y[1]
a5 = k5 * y[2]
f1 = -a1 -a2
f2 = a1 -a3 -a4
f3 = a4 -a5
f = np.array([f1, f2, f3])
return f
# Initial conditions for y[0], y[1] and y[2]
y0 = np.array([50000, 0.0, 0.0])
# Times at which the solution is to be computed.
t = np.linspace(0.5, 54.5, 28)
# Experimentally determined parameters.
k2 = 0.071
k5 = 0.029
# Parameters which would have to be fitted
k = 0.002
k3 = 0.1
k4 = 0.018
# Solve the equation
y = odeint(conc, y0, t)
# Plot data and the solution.
plt.plot(t, P, "bo")
#plt.plot(t, y[:,0]) # Substrate
plt.plot(t, y[:,1]) # Product 1
plt.plot(t, y[:,2]) # Product 2
plt.xlabel('t')
plt.ylabel('y')
plt.show()
如果我有三種不同濃度的實驗數據會怎樣?如何處理ODR的數據部分?,謝謝,M – Magnus