Modify ode45 so that the solution is always normed to 1
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!