# Curve fitting to coupled ODEs

have a question on curve fitting / optimizing. I have three coupled ODEs that descibe a biochemical reaction with a disappearing substrate and two products being formed. I've found examples that have helped me create code to solve the ODEs (below). Now I want to optimize the unknown rate constants (k, k3 and k4) to fit to the experimental data, P, which is a signal from product y. What would be the easiest way of doing this? Thanks. 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 a2 = k2 * y a3 = k3 * y a4 = k4 * y a5 = k5 * y f1 = -a1 -a2 f2 = a1 -a3 -a4 f3 = a4 -a5 f = np.array([f1, f2, f3]) return f # Initial conditions for y, y and y 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()
What if I have experimental data for all three changing concentrations? How would I treat the data part of the ODR?, Thanks, M

### 觉得文章有用就打赏一下文章作者

#### 支付宝扫一扫打赏 #### 微信扫一扫打赏 