[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Working example: passing parameters to lsode - Octave
From: |
Kai Torben Ohlhus |
Subject: |
Re: Working example: passing parameters to lsode - Octave |
Date: |
Tue, 31 Dec 2019 12:01:27 +0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 12/31/19 12:37 AM, Jana wrote:
> An example code using "lsode" for beginners...
>
> "Test.m" calls the function file "ODE.m"
>
> Content of "Test.m"
> ----------------------
>
> clear;
> clc;
>
> t = linspace (0, 50, 10); % Time interval for integration
> y0 = [ 4; 1.1; 4 ]; % Initial condition for Y(0)
> B=[77.27 8.375e-06 0.161]; % Additional fixed parameters used in ODE
> funct=@(y0,t)ODE(y0,t,B); % create a function to supply to LODE
> y = lsode (funct, y0, t) % Call LODE to solve
>
>
> % Content of "ODE.m"
> % ----------------------
>
> function y = ODE (x, t, B)
>
> y = zeros (3,1);
>
> y(1) = B(1) * (x(2) - x(1)*x(2) + x(1) - B(2)*x(1)^2);
> y(2) = (x(3) - x(1)*x(2) - x(2)) / B(1);
> y(3) = B(3)*(x(1) - x(3));
>
> endfunction
>
>
Thank you for the suggestion. Here on the help mailing list, your idea
might get lost. I opened a bug report [1] for you.
Best,
Kai
[1] https://savannah.gnu.org/bugs/?57508