[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 |
Hi,
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
that
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.
HTH,
c.
[1] type "help lsode" at the octave prompt to see the help
[2]
http://www.gnu.org/software/octave/doc/interpreter/Ordinary-Differential-Equations.html#Ordinary-Differential-Equations
[3] http://wiki.octave.org/Cookbook#Parametrized_Functions
[4] http://wiki.octave.org/Bim_package#3D_Time_dependent_problem
[5] type "help daspk" at the octave prompt to see the help
[6]
http://www.gnu.org/software/octave/doc/interpreter/Differential_002dAlgebraic-Equations.html#Differential_002dAlgebraic-Equations
- Translating ODE from Matlab to Octave, RICHARD Dominique, 2013/11/26
- Re: Translating ODE from Matlab to Octave,
c. <=
- Re: Translating ODE from Matlab to Octave, Bård Skaflestad, 2013/11/26
- Re: Translating ODE from Matlab to Octave, c., 2013/11/26
- Re: Translating ODE from Matlab to Octave, Bård Skaflestad, 2013/11/26
- Re: Translating ODE from Matlab to Octave, c., 2013/11/26
- Re: Translating ODE from Matlab to Octave, Torsten, 2013/11/26
- Re: Translating ODE from Matlab to Octave, c., 2013/11/26
- Re: Translating ODE from Matlab to Octave, Torsten, 2013/11/26