Help in understanding ode45 options
显示 更早的评论
Hello everyone,
I have been looking at ode45 option examples and I can't get my head aroung this one, that seems to appear quite often.
Soory if it's a trivial question by the way; here is the code in question:
[sectioncon,Y]=ode45(@EOM,ppartie,param1,[],[6 5 4 3 2 1]);
What is the use of the empty parenthesis ? and the array of numbers after that ?
6 个评论
Star Strider
2020-4-29
I do not recognise that ode45 calling syntax. What MATLAB version/release are you using?
The empty square brackets [], denoting the empty array, tell the function (regardless of what the function is) to use the default value for that parameter. They are passed in place of the parameter in that position. (In MATLAB, the order of function arguments is important,)
Lucas Mangin
2020-4-29
Star Strider
2020-4-29
My pleasure.
Do you have any clue as to what MATLAB version was used for that ode45 call? Is tthere any indication in the code itself? As I mentioned, it does not look at all familiar to me.
Lucas Mangin
2020-4-29
Star Strider
2020-4-29
编辑:Star Strider
2020-4-29
If that code still works, then it might be best just to leave it alone. If it has problems, it’s probably possible to rewrite it into more recent syntax so it will run correctly. For that, it’d be necessary to see some of the code preceeding it.
EDIT — If it runs as written, just leave it alone. It may not be worth the effort to make it compatible with the current syntax, unless it’s going to be used frequently in the future. In that situation, rewriting some of the rest of it for the same reason would also be appropriate.
Lucas Mangin
2020-4-29
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
