help-octave
[Top][All Lists]
Advanced

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

Re: lsode use


From: Juan Pablo Carbajal
Subject: Re: lsode use
Date: Wed, 26 Aug 2015 10:27:20 +0200

On Wed, Aug 26, 2015 at 10:10 AM, Céline <address@hidden> wrote:
> Thank you for your help,
> But I really don't see how to apply this :/ (I'm quite a beginner...) Do I
> need to make another file with my function dX/dt=-J ?
> So I can write ("humsolide" is the name of my other .m file with this
> function):
> x=@(J) humsolide ?
> And then apply lsode ?
>
> Thank you,
>
> Céline
>
>
>
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/lsode-solver-problem-tp4672270p4672287.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

Hi Céline,

1. Assume you have a function that retunrs the value fo J for a given time t

function Jvalue (t)
  # content
endfunction

And then that the function defining the equations is

function dxdt = dynsys (x,t, J)
  dxdt = -J(t);
endfunction

You can pass this to lsode as an anonymous function
func = @(x,t) dynsys(x,t, @Jvalue);

see more examples here
http://wiki.octave.org/Cookbook#Parametrized_Functions

2. You can also directly embed the J function within dynsys if it has
only one form, see the 2nd Demonstration of sigmoid_trian here
http://octave.sourceforge.net/signal/function/sigmoid_train.html

3. If the function J comes from data (that is you do ot have a
function of time, but only some finite values of it) you can use
datatofun http://octave.sourceforge.net/signal/function/data2fun.html
or you can write your own interpolation using interp1 (this is what
data2fun does check its code).


Good luck



reply via email to

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