If you have calculated the trajectories with ode45, ode23 and a manually code RK4, and you get similar results, you can be sure, that the results are exactly, what you have coded. If you expect something else, either the code is wrong, or your expectations. You can imagine that we cannot debug e.g. the construction of MATBIT. Codes like:
z4=dh(m,1);
z5=eh(m,1);
z6=fh(m,1);
z7=gh(m,1);
or
u2=real(C(1,1)*v(2,1)*e1*tt+C(2,1)*v(2,2)*e2*tt+C(3,1)*v(2,3)*e3*tt+C(4,1)*v(2,4)*e4*tt+C(5,1)*v(2,5)*e5*tt+C(6,1)*v(2,6)*e6*tt+EQSOL1(2,1));
prevent understanding and impede debugging. So I have to say: Sorry, I do not think that anybody can find the problem. I would never trust the results of this code, even if they satisfy your expectations.
Best Answer