Normalisation inside ODE function
조회 수: 5 (최근 30일)
이전 댓글 표시
Dear All,
I have a issue descibed as follows
The following are the Euler integration equations in the original code inside a while loop
Var1 = Var1 + dVar1 * delt;
Var2 = Var2 + dVar2 * delt;
Vau3 = Var3 + dVar3 * delt;
Var4 = Var4 + dVar4 * delt;
tnor = sqrt(Var1*Var1 + Var2*Var2 + Vau3*Var3 + Var4*Var4);
Var1 = Var1 / tnor;
Var2 = Var2 / tnor;
Vau3 = Var3 / tnor;
Var4 = Var4 / tnor;
Iam reqriting using ODE method based code (in built matlab function). There seems to be issue the way normalisation of Var1, Var2, Var3, Var4 is to be done. If i do not do the normalisation the two codes match. (of the course the results will not be correct. The variables need to be normalised before next step of integration).
How should i implement the above last five lines so that when the solver evaluates the function in the next iteration it uses the normalised value for Var1, Var2, Var3 & Var4. Currently in ODEFUN i was doing this in beginning by writing
tnor = Y(1 )+ Y(2) + Y(3) + Y(4)
Y(1) = Y(1)/tnor
Y(2) = Y(2)/tnor
Y(3) = Y(3)/tnor
Y(4) = Y(4)/tnor
This does not work.
Regards,
Tarun Uppal
댓글 수: 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!