我正在尝试编写下面显示的ODE系统。
如图所示,第二个ODE完全取决于第一个ODE的值 我如何编写第二个颂歌? 我正在使用ode45。
答案 0 :(得分:3)
是的,这很有可能。将x
定义为[c;ce]
,然后您可以使用以下内容:
function dx = my_ode(t,x)
% parameters definition
kf = ...; % whatever value you are using
P0 = ...; % whatever value you are using
Jer = ...; % whatever value you are using
J_serca = ...; % whatever value you are using
gamma = ...; % whatever value you are using
% differential equations
dc = (kf*P0+Jer)*(x(2)-x(1)) - J_serca;
dce = -gamma*dc;
dx = [dc;dce];
然后你可以将颂歌解析器称为:
tspan = [0 10]; % or whatever time interval you want to solve the odes on
x_init = [0;0]; % ot whatever initial conditions you want to use
[T,Y] = ode45(@my_ode,tspan,x_init);