Help in understanding ode45 options
Afficher commentaires plus anciens
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 commentaires
Star Strider
le 29 Avr 2020
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
le 29 Avr 2020
Star Strider
le 29 Avr 2020
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
le 29 Avr 2020
Star Strider
le 29 Avr 2020
Modifié(e) : Star Strider
le 29 Avr 2020
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
le 29 Avr 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
