Can I use two separate ODE call functions for a system of two differential equations in MatLab? -
i trying code system of ode's shown below.
as seen, second ode depends on value of first ode.
how can code second ode? using ode45.
yes, that's quite possible. define x
[c;ce]
, have like:
function dx = my_ode(t,x) % parameters definition kf = ...; % whatever value using p0 = ...; % whatever value using jer = ...; % whatever value using j_serca = ...; % whatever value using gamma = ...; % whatever value using % differential equations dc = (kf*p0+jer)*(x(2)-x(1)) - j_serca; dce = -gamma*dc; dx = [dc;dce];
and can call ode solver as:
tspan = [0 10]; % or whatever time interval want solve odes on x_init = [0;0]; % ot whatever initial conditions want use [t,y] = ode45(@my_ode,tspan,x_init);
Comments
Post a Comment