From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: ode solvers and outputing dependent variables
Date: Fri, 13 Mar 2009 13:18:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <gpdmea$4sf$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1236950282 5007 (13 Mar 2009 13:18:02 GMT)
NNTP-Posting-Date: Fri, 13 Mar 2009 13:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1753483
Xref: comp.soft-sys.matlab:524585


Is there any way to output dependent variables that are calculated within the 'ode function' or the 'event' function? For example:

function dxdt = odefun(t,x)
y = ugly function of t and x
z = ugly function of t and x
dxdt = [y*z; z];

since i'm calculating the values in 'odefun', i want to get y and z out so i dont have to calculate the values again after the ode solver (ie ode23s) is done. ideally, i'd be able to get the values of y and z for every time step.

right now the only options i see are to forgo using the matlab ode solver and write my own solver (i dont trust my ability to do this well) or to have the values written to a file each time step (doesnt seem very efficient).