Determination of the Newtonian gravitational constant G with a nonlinear fitting method