A new approach for quantum gate generation, called Reference Input Generation Algorithm (RIGA) is introduced. Let X −1 (t) be the trajectory that is obtained in step − 1, with X −1 (t) = I. In step , X −1 is right-translated in order to displace X −1 (T f) to X goal. The translated trajectory is used as a reference for a Lyapunov-based tracking control law, generating X (t) and so on. A proof of the exponential convergence of X −1 (T f) to zero is provided for T f large enough. Two examples presents numerical experiments regarding N coupled qubits. The first example considers N = 3 with a known minimum time T *. It presents excellent results for T f ≤ T *. The second example is a benchmark for the comparison between RIGA and GRAPE, considering a Hadamard gate for the systems with N = 2, 3,. .. , 10 qubits. The runtime of RIGA could be improved, and GRAPE was implemented in a faster CPU. However, RIGA presents results that are similar to GRAPE, with faster runtime in some cases, showing that the RIGA is indeed a promising algorithm.