problems about dde15s solving delay differential equation
조회 수: 5 (최근 30일)
이전 댓글 표시
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
Valeriia Hutor
2019년 4월 2일
Hi Leo,
Did you resolve this issue? I currently have the same with my equations.
Thank you.
Shiny Samuel
2020년 8월 12일
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
답변 (3개)
George Sarantoglou
2019년 12월 20일
편집: George Sarantoglou
2019년 12월 20일
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
Shiny Samuel
2020년 8월 7일
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!
Michelle Przedborski
2022년 2월 15일
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
댓글 수: 0
Alec Sargood
2021년 5월 14일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Delay Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!