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: Mon, 2 Nov 2009 00:00:54 +0100


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: equazioniPatu.pdf
Description: Adobe PDF document

Attachment: scriptode45.m
Description: Text Data



reply via email to

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