An analytical solution for relative motion with an elliptic reference orbit