help-octave
[Top][All Lists]
Advanced

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

Re: Non homogeneous differential equations


From: Geordie McBain
Subject: Re: Non homogeneous differential equations
Date: Mon, 21 May 2007 10:38:24 +1000

On Sun, 2007-05-20 at 16:31 +0200, François Poulain wrote:
> Hello,
> 
> I am a student in control theory, and for many applications, I need to
> solve non homogeneous ODEs like \dot x = f(x,t,u(t))
> 
> Is there possible with GNU/Octave ? I didn't find any way in the help or
> in internet.
> 
> In matlab, I am using the following sequence :
> ode45(@(t,x) f(t, x, u), tspan, x_0);

Octave does have a lot of specialized functions for control theory
problems, but I don't know anything about them.

However, for marching a dynamical system like this you can use the
function lsode; for example, for x' = sin (t*x) with x = 1 at t = 0, do

octave-2.9.10+:1> t = linspace (0, 10, 1001)'; 
octave-2.9.10+:2> x = lsode (@ (x, t) cos (x*t), 1, t);
octave-2.9.10+:3> plot (t, x)

I believe lsode is a fair bit more sophisticated than ode45, using
variable step size and variable order up to quite high order (12 or
13?).  It should be more efficient for problems with reasonably smooth
solutions.

Hope this helps.  (I wasn't too sure what u (t) was in your question.
Did I miss something?)

Geordie McBain


Send instant messages to your online friends http://au.messenger.yahoo.com 


reply via email to

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