Output of sink / source terms when solving ODEs

1 次查看(过去 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 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by