How to plot this (time delayed) system in matlab?

59 views
Skip to first unread message

Ahmad Sheikh

unread,
Apr 17, 2015, 7:03:42 AM4/17/15
to yal...@googlegroups.com
I have a time delayed state space model like this...!

dx1/dt = x1(t) + x2(t) + x1(t-d(t)) +x2(t--d(t))

dx2/dt = 0.7*x1(t) + x2(t) + x1(t-d(t)) +0.5*x2(t--d(t))

where x(t-d(t)) is the delayed state....
and our delay is time variant given by d(t) = 3+2*cos(t)...

i know about dde23 but it's for time invariant delays...

i wrote  a code like this....

function v=f(t,x)
             v=zeros(2,1);

v(1) = x(1) +  x(2);
v(2) = 0.7* x(1) + x(2);

Initial_Time=10;
Final_Time=5000;
[x1,x2] = meshgrid(-2:0.1:2);

[t,x] = ode45(@v, [Initial_Time Final_Time], [0.01624 0.1535]);

plot(x(:,1),x(:,2))


this code is without adding time delay...
will someone help how to add time delay in this....?

Johan Löfberg

unread,
Apr 17, 2015, 7:06:41 AM4/17/15
to yal...@googlegroups.com
This has nothing to do with YALMIP so you are really on the wrong forum, but I would create a simulink model with a varaible transport dealy

BTW,  no reason to predefine v using zeros

Ahmad Sheikh

unread,
Apr 17, 2015, 8:17:45 AM4/17/15
to yal...@googlegroups.com
Johan you are write i have posted this question in a lot of forums including mathworks, stachexchange, mathstackexchange but i didnt get answer for this one ...

so i just posted it  here...
i am not good in coding...

i dont get how to write this time delayed state in ordinary diffrential equation....

if you will do this for me either in simulink or matlab i will definately be thankful...!


Johan Löfberg

unread,
Apr 17, 2015, 8:19:33 AM4/17/15
to yal...@googlegroups.com
No one will do it for you.

Ahmad Sheikh

unread,
Apr 17, 2015, 8:29:39 AM4/17/15
to yal...@googlegroups.com
yeah...:(

Ahmad Sheikh

unread,
Apr 17, 2015, 11:03:12 AM4/17/15
to yal...@googlegroups.com
johan kindly help if u know how to do this in simulink...!
Reply all
Reply to author
Forward
0 new messages