Output of sink / source terms when solving ODEs
2 次查看(过去 30 天)
显示 更早的评论
Hi there.
I'm running a simple series of ODEs using ode113. My model is behaving itself, but I want to understand what's happening with the sink and source terms (i.e. those terms that make up the dX / dt equation). I currently use a "OutputFcn" option that simply appends these to a global array that I can interrogate later.
function [status] = get_process(t, y, flag);
% Sets up process outputs
% Note : I've not worked out yet why this has a different time frame on it to the state variable outputs.
global tmp_processes processes;
processes = [processes; tmp_processes];
status = 0;
However, while my model does appear to behave itself, I can't square the sinks and sources it uses. I'm suspicious that the simple function above might be resulting in errors because it produces output on a somewhat different timeline from the main model (i.e. I have state variables on one time axis, the above on another).
Anyway, my question is what's the best way to access accurate sink and source terms from an ODE model in Matlab? I can't find much help from the Mathworks site on the "OutputFcn" option, but I'm assuming lots of people have the exact same problem to solve.
Thanks in advance!
Andrew
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!