[Top][All Lists]

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

Re: Translating ODE from Matlab to Octave

From: c.
Subject: Re: Translating ODE from Matlab to Octave
Date: Tue, 26 Nov 2013 16:42:25 +0100


On 26 Nov 2013, at 15:19, RICHARD Dominique <address@hidden> wrote:

> Hello everybody,
>   I am switching from Matlab to Octave and I got some code that I am not sure 
> how to deal with.
> For example these lines:
> options = odeset('Mass',M);
> f = @(t,y) daesystem(t,y,params);  
> [t,y] = ode15s(f,t,y0,options);
> which I transformed to :
> lsode_options
>       ('Mass',M);

I don't think "lsode_options" has an option called 'Mass', 
have you looked at the help for lsode [1] or at the help for lsode in 
the manual [2] before writing that command?
furthermore "ode15s" is often (although not exclusively) used to solve 
Differential Algebraic Equations (DAE), i.e. ODEs with a singular mass matrix.
From that and from the fact that your function is named "daesystem" I infer 
probably your problem is a system of DAEs.

If this is the case you should not be using lsode but rather daspk[5, 6] 
to solve your problem. 

Otherwise, if your mass matrix is not singular 
you can just redefine 

  f = @(t,y) M \ daesystem(t,y,params);  

to take the mass matrix into account.

> f = @(t,y) daesystem(t,y,params);
> [y,
>       t]= lsode(@(y,t) f, y0, t)

that is not the correct syntax for calling lsode, [1] and [2] will explain how 
to use it.

> which does not seem to run properly.
> I had a look at the Octave notice but besides the definitions, I did not 
> found clear enough examples for me to use.
do these examples [3, 4] help?

> I would be very grateful for any help to get me to the free side of software.


[1] type "help lsode" at the octave prompt to see the help
[5] type "help daspk" at the octave prompt to see the help

reply via email to

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