help-octave
[Top][All Lists]
Advanced

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

Re: octave and delay ode's


From: Carlo de Falco
Subject: Re: octave and delay ode's
Date: Tue, 3 Nov 2009 19:12:21 +0100


On 3 Nov 2009, at 14:58, franco basaglia wrote:


What exactly does "delta t" mean in your file?

what do you mean by "time units"?


From your pdf file and your script I get the feeling that you are confusing the time parameter in the continuos problem and the number of time- steps in the discretized
system...

Yes.You're right. I have confused "delta t" (time parameter in the contiunuos problem) and time-steps in the discretizet system, that are my "time units".
These time units are 5 and 10 in my DISCRETE function "delay".
Are you meaning this or that I have to modify my system in a discrete time system? I'm confuse about this question because, for example, Stella runtime equation is something like this:
....
L(t) = L(t−dt)+(−LtoM−LtoF)×dt
T(t) = T(t−dt)+(DELAY(S×(1−GP),10)×(1−T))×dt
and  Euler and 4th-order Runge-Kutta methods are used
with time step dt  set to 0.5 year

the functions in odepkg use adaptive time-stepping so

1) you cannot know in advance what the value of dt will be

and

2) dt it will vary during the simulation

therefore specifying the delay in terms of dt makes no sense,
if your time is measured in years your delay must also be expressed in years.
In particular the following command in your script:

res = ode45d (@fun, t, init, [5,10],ones(7,2));

means that at any given time t, "fun" will be called as

fun (t, x, xd)

where xd(:,1) is the value of the state vetor at the time point t-5 years
and xd(:,2) is the value of the state vetor at the time point t-10 years

is that what you want?

Anyway, I correct my script following your suggestion, but it doesn't work. And the different values from Stella concern, particularly, the 2 state variables with delay.
I have also this warning but I don't think that the problem is here:
warning: Option "RelTol" not set, new value 0.000001 is used
warning: Option "AbsTol" not set, new value 0.000001 is used
warning: Option "InitialStep" not set, new value 30.000000 is used
warning: Option "MaxStep" not set, new value 30.000000 is used

These are just warnings, you can safely ignore them at this stage, or specify the missing options if you want to get rid of them...

I attach my new script.

Your script runs without errors on my system, but I have no idea about what the results should look like so I cannot comment on their correctness.

thanks

best regrads
f.b.
c.


reply via email to

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