function [True,Eccen,Mean,check] = KeplerEq(t,t0,mu,a,e,nloop)
% [True,Eccen,Mean,check] = KeplerEq(t,t0,mu,a,e,nloop)
%
% variable     description
% t            a vector with epochs in seconds
% t0           time of last perigee transit
% mu           gravitation constant in m^3/s^2
% a            semi major axis
% e            eccentricity
% nloop        # iterations to converge the Kepler equation 
% True         true anomaly at t
% Eccen        eccentric anomaly at t
% Mean         mean anomaly at t
n = sqrt(mu/a^3);
Mean = n*(t-t0);
Eccen = Mean;
for i=1:nloop,
   Eccen = Mean + e*sin(Eccen);
   check = Eccen - e*sin(Eccen) - Mean;
end
True = atan2(sqrt(1-e^2)*sin(Eccen),cos(Eccen)-e);

