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: franco basaglia
Subject: Re: octave and delay ode's
Date: Tue, 3 Nov 2009 14:58:45 +0100


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


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


I attach my new script.



thanks

best regrads
f.b.






Il giorno 02 novembre 2009 00.00, Carlo de Falco <address@hidden> ha scritto:

On 1 Nov 2009, at 20:08, franco basaglia wrote:


I must be missing something as in your file I see no time derivatives...
sorry for my oversight. I attach again pdf with right system.

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


function f = fun (t, y, yd)
f(1) =-y(1) + yd(2);
f(2) =-y(2) ;
endfunction

ode23d (@fun, [0 5], [1;1], .1, [1;1])

notice that in the example above only one equation includes a delay:
is this what you mean by system of ODEs and DDEs?

Yes,sure.
To be more precise I have a system like this:
d y1(t)/ dt = -y1(t)
d y2(t)/ dt = -y2(t) + y1(t-5)
d y3(t)/dt  = -y3(t) + y2(t-10)*y1(t-10)

that I try to solve in this way:
function f = fun (t, y, yd)
f(1) =-y(1)
f(2) =-y(2) + yd(1)
f(3) =-y(3) + yd(2)*yd(1)
endfunction
t = [0:.5:20]
res = ode45d (@fun, t, [1;1;1], [5;10], ones (3,10))

I think this should rather be something like:


function f = fun (t, y, yd)
f(1) =-y(1);                   %% y1' = -y1(t)
f(2) =-y(2) + yd(1,1);         %% y2' = -y2(t) + y1(t-lags(1))
f(3) =-y(3) + yd(2,2)*yd(1,2); %% y3' = -y3(t) + y2(t-lags(2))*y1(t-lags(2))
endfunction

T = [0,20]                                            %% only initlial and final time
                                                     %% need to be provided

res = ode45d (@fun, t, [1;1;1], [5, 10], ones (3,2)); %% number of columns in HIST should
                                                     %% be the same as the number of columns
                                                     %% in LAGS

I beleive Thomas Treichl, the author of odepkg is listening on the list so maybe he can confirm whether this is correct?


It's run. But I don't think this is the right way.I don't know if with this notation it applies a delay of 5 time units to f(2) and of 10 time units to f(3).
what do you mean by "time units"?


Note that in f(3) yd(1) comes again but with a different delay.
Infact for my script, that I attach here, is the same. It's runs but with different results compare to Stella.

Any Idea?

>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...


thanks a lot

f.t.
c.

P.S. please keep the list in CC as someone else may want to help with your questions
or benefit from the answers.





Attachment: ode45delay.m
Description: Text Data


reply via email to

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