使用odeint Python绘制ODE系统的时间序列图之间的差异

时间:2019-02-11 10:38:26

标签: python matplotlib plot scipy odeint

我正在使用odeint函数在python中解决两个具有不同参数的Odes系统。我可以绘制它们两者,但我想直观地显示时间序列图的数据点之间的差异。下面是我的代码和示例。

from scipy.integrate import odeint
from pylab import *
import matplotlib.pyplot as plt

initial_condi = [.1,.1,.1,.1,.1]# Initial Conditions
t = np.arange(0, 18,.1)    

def equation(w, t): #System of ODEs defined in Equation 1
    T, U, V,W,I = w
    dT = 0.9*I*1*10.24 - T*0.0012
    dU = V*T*0.0154 - U*1*0.81        
    dV = W*0.1*0.12 + U*1*0.81 - V*1.64 - V*T*0.015        
    dW= V*1.64 + 0.7*1*0.47 - W*0.1*0.12 - W*U*1591.5*1        
    dI= T*0.0012 + 0.8*U*1410.79*1- 0.9*I*1*10.24 - I*1*1934.77*1

    return  dT, dU, dV, dW, dI    
result_init = odeint(equation, initial_condi, t)

def equation3(w, t):#Alternative System of ODEs defined in Equation 2

    T,U,V,W,I = w        
    dT = 0.00690000e02-0.00890000e02*T+4.6500000010*I+1.96600002*I    
    dU = U*T*0.29060000 - U*2.99990001+1.9000011*U        
    dV =- V*0.0090e02 + U*0.39+ W*0.022 - 1.6900e00*V        
    dW = V*0.00590001e-05 + 0.306001011 -W*0.19999002 - W*U*1303.271000e+00        
    dI= -105.00010e+01*I-73.54000000e01*I -0.17500060*U +0.00900000e+03 + 104.00120*U            
    return  dT, dU, dV, dW, dI
result_mdu = odeint(equation3, initial_condi, t)

plt.plot(t, result_init[:,0 ],'g',t, result_mdu[:,0],'b')
plt.show()

它绘制了以下图形:enter image description here

我想绘制图表以显示两个时间序列图使用odeint有何不同。就像下面的example所示。放下确切的例子并不重要。澄清表示感谢只是一个想法。 enter image description here

0 个答案:

没有答案