Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ode solvers and outputing dependent variables
Date: Fri, 13 Mar 2009 17:06:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 38
Message-ID: <gpe3pp$9s9$1@fred.mathworks.com>
References: <gpdmea$4sf$1@fred.mathworks.com> <11480465.1236952905630.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1236963961 10121 172.30.248.38 (13 Mar 2009 17:06:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 13 Mar 2009 17:06:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1753483
Xref: news.mathworks.com comp.soft-sys.matlab:524665

Thank you for your input. I've been trying to implement the mass matrix approach but to no avail (using the example 'hb1dae' as a guide). from the example that i provided yesterday, could you possibly give me an example of what you mean so i can get 'y' out? Thanks

Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <11480465.1236952905630.JavaMail.jakarta@nitrogen.mathforum.org>...
> > Hello
> > 
> > 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).
> > 
> > Thanks
> 
> The ODE-solver solves systems of the form
> M*u'=f.
> Add y and z as algebraic variables to your 
> system of ODEs by setting the corresponding rows
> of the mass matrix M to zero.
> Then you can write output for them like for any 
> other ODE-variable.
> 
> Best wishes
> Torsten.