problems about dde15s solving delay differential equation

5 views (last 30 days)
I have a problem solving stiff delay differential equations recently. I just found that there's a paper written by Vikas Agrawal's group and they used a solver called "dde15s" for there calculation.
We can find the paper at the following website: https://onlinelibrary.wiley.com/doi/10.1021/bp034226s
At the bottom of the website, click "Supporting Information", and download the zip file "bp034226ssi20030804_024052.zip", which the dde15s.m is inside (or you may download the attachment form this comment).
But I found a new problem. I try to use dde15s instead of dde23 in my code, then the error appears:
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in dde15s>solextend (line 155)
solout.idata.kvec = [sol.idata.kvec; solex.idata.kvec(2:end)];
Error in dde15s (line 139)
sol = solextend(sol,solex);
In dde15s.m, function "solextend" is for Concatenate two solution structures produced by ODE15S. And the Author said " This function works with ODE15S from MATLAB 6.5, but it may require modifications to work with other versions."
I think the error exist in my code because I use the Matlab 2017a version. So is there anyone can fix that error and make "dde15s.m" fit to the newest version of Matlab?
Thanks for all your help.
  2 Comments
Valeriia Hutor
Valeriia Hutor on 2 Apr 2019
Hi Leo,
Did you resolve this issue? I currently have the same with my equations.
Thank you.
Shiny Samuel
Shiny Samuel on 12 Aug 2020
Hi Leo,
Were you able to resolve this issue? I am also currently trying to use DDE15s and running into the same problem.
Please do let me know.
Thanks,
Shiny

Sign in to comment.

Answers (3)

George Sarantoglou
George Sarantoglou on 20 Dec 2019
Edited: George Sarantoglou on 20 Dec 2019
After struggling for two hours I made it work. I use Matlab 2017a.
Fist of all in the solextend function you should change the ";" character with "," in the fourth and last line - solout.idata.kvec, solout.idata.dif3d lines.
function solout = solextend(sol,solex)
% Concatenate two solution structures produced by ODE15S.
% This function works with ODE15S from MATLAB 6.5, but
% it may require modifications to work with other versions.
solout.solver = 'ode15s';
solout.x = [sol.x, solex.x(2:end)];
solout.y = [sol.y, solex.y(:,2:end)];
solout.idata.kvec = [sol.idata.kvec, solex.idata.kvec(2:end)];
dim3 = size( sol.idata.dif3d,3);
dim3ex = size(solex.idata.dif3d,3);
if dim3ex > dim3
sol.idata.dif3d(:,:,dim3+1:dim3ex) = 0;
dim3 = dim3ex;
elseif dim3ex < dim3
solex.idata.dif3d(:,:,dim3ex+1:dim3) = 0;
end
solout.idata.dif3d = [sol.idata.dif3d , solex.idata.dif3d];
In the main body, I have also made the following modifications and the whole thing works just fine.
solex = ode15s(@(t,y) ddefcn(t,y,ddefun,lags,history,solast,varargin),[b e],solast.y(:,end),options);
% solex = ode15s(@ddefcn,[b,e],sol.y(:,end),options,...
% ddefun,lags,history,sol,varargin{:});
solast = solex;
if (i == 2) && (j == 1) % Initialize solution structure.
sol = solex;
else
sol = solextend(sol,solex);
end
end
end
sol.discont = discont;
  1 Comment
Shiny Samuel
Shiny Samuel on 7 Aug 2020
Hi George,
I have changed dde15s using the following edits you've made. However, I keep getting the error: Unrecognized function or variable 'solast'.
Have you defined solast elsewhere in the code?
Thanks in advance for your help!

Sign in to comment.


Michelle Przedborski
Michelle Przedborski on 15 Feb 2022
I have an updated version of the code that works in Matlab R2018b and newer releases (updated by Jacek Kierzenka at Mathworks). The code can be downloaded/viewed from here: https://github.com/mprzedborski/venetoclax-tedizolid/blob/3b4b84df0aa797a0761d9509756aa6f25dcffc17/dde15s_updated.m

Alec Sargood
Alec Sargood on 14 May 2021
Hi George,
I would be very interested to know if you managed to fix the code for dde15s, as I'm currently working on a project looking to solve stiff ddes.
Thanks

Community Treasure Hunt

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

Start Hunting!