From: Brendan on
Hi,
This isnt a very "code" oriented question, but Im developing a code to simulate a body travelling under a central force. The units for distance I am using are in A.U for convenience, but Im trying to convert the time over which the simulation takes place back into real time for presentation sake. So say for example I have:

z=[x_position; y_position; x_velocity; y_velocity]
Time=zeros(1110,1) %create zero vector to hold the times
tend=0.1
for i=1:100
[t,z]=ode45(@twobodyfunctionmars,[0:0.01:tend],z0,options);
Time(1:length(z))=t(:,1);
end

now, Ive used:
Time_total=length(Time)*0.01

to find the total time over which the problem has been solved.
Lets say the total time I get for a given orbit is 15.63 seconds using a time step of 0.01.
Could anyone tell me the best way to convert this to real time, i.e. years? I've done it for Mars's orbit and got some crazy answer. Basically I divided time_total by 1 metre(in A.U). I must be making a mistake.
Apologies if this post doesnt seem relevant to Matlab.
Thanks
Brendan