help-octave
[Top][All Lists]
Advanced

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

Re: Translating ODE from Matlab to Octave


From: Bård Skaflestad
Subject: Re: Translating ODE from Matlab to Octave
Date: Tue, 26 Nov 2013 16:54:51 +0100

On Tue, 2013-11-26 at 15:19 +0100, RICHARD Dominique wrote:

> f = @(t,y) daesystem(t,y,params);  
> [t,y] = ode15s(f,t,y0,options);
> 
> which I transformed to :

[...]

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

Try f = @(y, t) daesystem(t, y, params)

The call

        lsode(@(y,t) f, ...)

makes no sense because 'f' is a function handle so

        @(y,t) f

is a function that, for all parameter pairs (y,t) returns the original
function handle ('f') rather than the value of the function (daesystem)
at (y,t).

Alternatively, you *could* use

        [y, t] = lsode(@(y, t) f(t, y), y0, t)

if you don't want to change the definition of 'f'.


Sincerely,
-- 
Bård Skaflestad <address@hidden>
SINTEF ICT, Applied mathematics



reply via email to

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