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: Thomas Treichl
Subject: Re: octave and delay ode's
Date: Mon, 02 Nov 2009 20:26:37 +0100
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Carlo de Falco schrieb:
On 1 Nov 2009, at 20:08, franco basaglia wrote:
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?

Because there is an "ode" in the subject of the email, yes, but I also must say that I currently don't have the time to dig into this problem and can only provide a short answer: if the above equations form the DDE problem then Carlo's implementation does make more sense to me.

Best regards

  Thomas


reply via email to

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