[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: ode45 for coupled system (2nd order ODE)

From: Allen.Windhorn
Subject: RE: ode45 for coupled system (2nd order ODE)
Date: Fri, 9 Nov 2012 14:50:25 +0000


> -----Original Message-----
> From: address@hidden [mailto:help-octave-
> Hi guys. I haven't used ode45 before, so I was hoping to get
> some help here regarding its use.
> I want to solve a coupled system, namely dy2/dt = -sin(y1) and
> dy1/dt = y2.
> ode45 will solve this for me for y1 as a function of t, that's
> nice.  But say I want to obtain (y1, dy1/dt) ... is there a nice
> way of doing this, or will ode45 only put out (y1, t) ?

You have y2, which is dy1/dt.  If you need all the derivatives,
you already have a function to use in ode45 like

fdydt = @(t,y) [-sin(y(2); y(1)];

so your derivatives can be calculated as fdydt(t,y).

I tried to use ode45 for Matlab compatibility, but had some trouble
with convergence, so I have been using lsode instead.  The system
you are showing here is not stiff, so ode45 should work OK, but you
may want to try other methods as you get more complex problems.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]