Solving a delay differential equation with ddesd

Hello,
as the title suggest I am trying to solve a specific type of dde with built-in function ddesd.
The Problem is as follows: The dependent variable is y. The independent variable x is discretized with grid points n=1,…,N. The DDE is of the form dy/dx=f(y(n), y(k), x(n) ,x(k)), where k with k<n is a previous grid point that has to be determined from a side condition at each grid point n (i.e. k varies). The side condition also contains y(n), y(k), x(n) and x(k).
This type of problem can easily be solved by the Euler method. A very reduced (and nonsensical) example for this is below. However, I want to solve it with a higher order method. I tried ddesd but the issue is that I do not know how to obtain y(n), y(k), x(n) and x(k) and how the delay function should be used. How can I get ddesd running for this type of problem? Or is there another preferable solver?
Any help would be greatly appreciated!
Iter=1000;
x=linspace(0,10,Iter);
step=x(2)-x(1);
m=5; %at this grid point integration starts
y=[10.1,10.5,11.6,12.1,13.3]; %specify history of y for grid points n=1:m
for n=m:Iter
for k=1:n
if y(n)/y(k)-x(n)/x(k)>0 %If this side condition is fulfilled, we have found k
break %break inner loop in this case
end
end
k_n(n)=k; %collect values of k at each iteration
y_p=y(k)/y(n)+exp(x(k)*x(n)); %derivative
y(n+1)=y_p*step+y(n); %Euler method
end
subplot(2,1,1)
plot(x,y(1:n))
ylabel('y')
xlabel('x')
subplot(2,1,2)
plot(x(m:n),k_n(m:n))
ylabel('k')
xlabel('x')

 Réponse acceptée

Torsten
Torsten le 29 Juin 2017
Modifié(e) : Torsten le 29 Juin 2017
In my opinion, there is no available DDE solver that can cope with your problem.
The problem is that the length d of your delay at X does not only depend on y(X), but on the complete history y(x) for x<=X.
In your example from above,
d(x,y(x)) = sup (d'>0) {y(x)/y(x-d')-x/(x-d') > 0}
As you can see, y(x-d') for all 0<=d'<=x must be available to compute d(x,y(x)).
Best wishes
Torsten.

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by