Toward improved performance of fast and nanoaccurate motion systems an iterative tuning procedure for the parameters of a variable gain controller is presented. Under constrained optimization, optimal values for the variable gain parameters are found by minimizing a quadratic function of the servo error signals in a representative sampled-data interval. An effective method for improved performances is demonstrated on a scanning stage system, using a combined model/data based approach in obtaining the gradients with respect to the parameters to be optimized