In a system of differential equations using ode solvers I am getting extremely small numbers that over time increase when they should remain zero throughout, how to fix this?
1 次查看(过去 30 天)
显示 更早的评论
I currently have a code that solves concentrations for different molecules within a signaling system that is modeled by differential equations that account for production and degradation rates, most of them follow the law of mass action. I am facing difficulties when I introduce small values for some of the initial concentrations that are used by the ode solver as some of these concentrations should be zero given the right input, however at a certain point values such as 1.035*10^-9 start to appear and accumulate error that result later in concentrations of 1.20 when these should be zero.
4 个评论
Torsten
2022-4-18
The solver sends
Cy4 + h
to your function in order to build the Jacobian matrix (if you use ode15s or another stiff solver for integration).
Maybe this is what you observed. But the correct value of Cy4 after a time step cannot be inspected in your ODE function, but only in the OutputFcn function or after the solver has returned the solution to the calling program.
Sam Chak
2022-4-19
编辑:Sam Chak
2022-4-19
I treat this as a single ODE and make a quick test below:
dcCy4/dt = - kf10*Nuc3*Cy4 - kf2*CytSA*Cy4 + kr2*CytSA
Attempts to find the equilibrium:
Since you set and the rest are non-zero constants, then .
kf10 = 1
Nuc3 = 1
kf2 = 1
CytSA = 0
kr2 = 1
% Ordinary differential equations
f = @(t, x) - kf10*Nuc3*x - kf2*CytSA*x + kr2*CytSA;
tspan = [0 100];
init = 0; % initial condition
[t, x] = ode45(f, tspan, init);
plot(t, x, 'linewidth', 1.5)
ylim([-1e-9 1e-9])
Logical deduction:
If the steady-state value of , this implies that .
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!