Modify ode45 so that the solution is always normed to 1
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear all,
I have a three-dimensional ode which I'd like to solve using a 4th order Runge-Kutta method, but I'd like the solution to always be normed:
y1(t)²+y2(t)²+y3(t)² = 1, for all t.
This is not the case when I use ode45 despite the fact that it should be from analytical study of the ode. How can I enforce such a constraint by modifying the ode45.m file (or by any other means)?
Thank you.
Edit :
I tried to modify the file ode45.m in MATLAB/R2012a/toolbox/matlab/funfun/ by setting ynew = ynew/norm(ynew) on line 274, but for some reason, it seems that editing this file doesn't change the solution I get, even if I set, say, ynew = 0, and after having restarted Matlab. Is there something more to do so that Matlab accept the changes?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!