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
endsubplot(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')
Best Answer