Mackey Glass equation and ddesd

I am trying to extract Mackey-Glass attrcator through ddesd package. Initially, I need the series, so here are my codes
sol = ddesd(@ddefun,@delay,@history,[0 30000]);
t = sol.x;
x = sol.y;
plot(t,x);
x0 = rand;
function dxdt = ddefun(t,x,Z)
dxdt = 2*Z/(1 + Z^(9.65)) - x;
end
function d = delay(t,x)
d = t - 2;
end
function v = history(t)
v = 0;
end
Sadly, I get no series. I do not know what I have missed out. I genuinely ask for your help.

 Accepted Answer

So in these equations you're using the Equation 2 form where is 2, θ is 1, n is 9.65, τ is 2, and γ is 1?
If the density of the cells starts off at P(t) = 0 (as is the case based on your history function) why do you expect any cells to spontaneously come into existence? If I changed your history and the time over which I solved the system (to fit in the time restrictions of MATLAB Answers) I got a non-constant answer. Whether or not this is correct is something for you to determine.
If you're going to generalize this I'd define the parameters as constant values in ddefun (or have ddefun accept them as additional parameters) to make it easier to modify the equations (simply by changing the parameter values, rather than changing the equations.) I did this for two of the parameters, n and tau.
sol = ddesd(@ddefun,@delay,@history,[0 30]); % Changed from 30000 to 30
t = sol.x;
x = sol.y;
plot(t,x);
function dxdt = ddefun(t,x,Z)
n = 9.65;
dxdt = 2*Z/(1 + Z^n) - x;
end
function d = delay(t,x)
tau = 2;
d = t - tau;
end
function v = history(t)
v = 0.5; % Changed from 0 to 0.5
end

3 Comments

Thank you so much Mr. Lord. This is my first time that I am working with delayed equations, so I have no clue if it is possible to plot(x(t),x(t-2)) with "x" at hand.
sol = ddesd(@ddefun,@delay,@history,[0 30]); % Changed from 30000 to 30
t = sol.x;
x = sol.y;
tint = 0:0.01:30;
xint = deval(sol,tint);
for i = 1:numel(tint)
if tint(i) <= 2
xintm2(i) = history(tint(i)-2);
else
xintm2(i) = deval(sol,tint(i)-2);
end
end
plot(xint,xintm2)
function dxdt = ddefun(t,x,Z)
n = 9.65;
dxdt = 2*Z/(1 + Z^n) - x;
end
function d = delay(t,x)
tau = 2;
d = t - tau;
end
function v = history(t)
v = 0.5; % Changed from 0 to 0.5
end
This is what i was looking for. Thanks a lot.

Sign in to comment.

More Answers (1)

Torsten
Torsten on 19 Sep 2023
Moved: Torsten on 19 Sep 2023
I'm not sure what you are exactly asking for, but for a history v = 0, the solution is v = 0 for all times t > 0.
So the plot you get is correct.

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!