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!