A single-degree-of-freedom nonlinear spring-mass system, subjected to a particular shaped input force whose magnitude varies with time in a piecewise-constant manner is considered. The goal is to bring the point mass in the model system from initial rest to a prescribed new equilibrium position without exciting any residual vibration. If, ideally, the potential energy associated with the elastic spring is known as a function of its elongation, the magnitude and execution time of each force step that serve the abovesaid purpose can be calculated by analyzing the mechanical energy flow. However, in practice the potential function almost inevitably contains a small estimation error, and residual vibration would be excited by the input force so calculated. By use of asymptotic techniques, the residual vibration excited by a two-step input force with slightly incorrect task time and force magnitudes is calculated. It is also demonstrated that, by comparing the closed-form results of the asymptotic analysis with online measurements of the excited residual vibration, the shape of the two-step input force (characterized by the task time and force magnitudes) can be corrected iteratively, thereby suppressing the residual vibration.