Working with modified code -2024A

조회 수: 15 (최근 30일)
Nathan Bblanc
Nathan Bblanc 2024년 6월 16일
댓글: Nathan Bblanc 2024년 6월 17일
I am working with a slightly modified version of ode113 (basically we copied ode113 into a new function ode113a and made some modifications there). Until now I was using the same code I copied and pasted and modified a few versions ago. Now in 2024A I got an error message, so I copied the code of ode113 again into a new file and modified again. However, a new problem has risen- it seems that 2023 is dependant on private functions, and I am now getting "unrecognized function or variable" errors. A workaround that I found is copying all the relevant private folders into a new folder. Is that the best way to solve the issue?
many thanks
Nathan
  댓글 수: 2
Steven Lord
Steven Lord 2024년 6월 16일
What modification did you make to ode113? Why did you need to modify it? Is it possible to achieve the same results without modifying the function that is part of MATLAB?
The best solution is not to modify functions that are included with MATLAB, as other functions in MATLAB may depend on it and so you could impact the basic functionality of MATLAB.
Nathan Bblanc
Nathan Bblanc 2024년 6월 16일
편집: Nathan Bblanc 2024년 6월 16일
Hi Steven, thank you for the answer, Basically, we noticed that under certain conditions, rather than diverging or failing, ode113 takes a very long time to run (more than 30 seconds) , and this is unacceptable as it is part of a larger code that calls ode113 thousands of times. So we added a tic at the begining of the code and a toc inside the main loop. if the toc exceeds 10 seconds an error is invoked.
We couldn't find a way to create this functionality without modifying the code itself (Although I think it is a good idea in general! something like try/catch but with a clock), do you know of such a way?
P.S. we didn't actually modifiy the built in function, we copied the code and pasted it to a new function "ode113a" and modified that, so I don't think we are actually in danger of impacting the basic functionality of MATLAB

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2024년 6월 16일
If your system of ODEs is taking a long time, it may be stiff. Try using one of the stiffer solvers.
Alternately you could try creating either an EventFcn or an OutputFcn and have them stop the solver if enough time has elapsed since the solver started.
Finally, you could send an enhancement request for the ODE solvers to have an option for a timeout to Technical Support.
  댓글 수: 1
Nathan Bblanc
Nathan Bblanc 2024년 6월 17일
Thank you Steven! I will look into the options you mentioned

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by