Computes the mean square displacement of a trajectory