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?