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.
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))
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). 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?
thanks a lot
f.t.
2009/10/29 Carlo de Falco
<address@hidden>
On 29 Oct 2009, at 16:38, franco basaglia wrote:
sorry, I don't know what "stella" is so I do not understand this syntax,
Stella is a simulation development environment. Delay sintax is in [1]
maybe you could describe your system in plain mathematical syntax?
I attach a pdf with my ode's system. Only equations number 6 and number 7 have a delay as you can see.
I must be missing something as in your file I see no time derivatives...
yes, odepkg comes with a very nice set of examples and a pdf manual, type
odepkg_examples_dde ()
to see some DDE examples.
Thanks.I'm trying to use it. I dont' yet understand how to apply in a system with
DDE's and ODE's
ode23d (fun, [t0, tend], y0, tau, h)
solves the DDE sysytem
dy/dt = fun (t, y(t), y(t-tau))
y(t0) = y0
y(t) = h, t<t0
where of course y,y0,h can be vectors.
for example to solve the following system in 0<t<=5:
d y1(t)/ dt = - y1 (t) + y2 (t-.1)
d y2(t)/ dt = - y2 (t)
y1(t) = y2(t) = 1, t<=0
you can do:
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?
HTH,
c.