1. A discrete-time adaptive neural network compensator for compensating backlash of a mechanical system, comprising: a feedforward path; a proportional derivative tracking loop in the feedforward path; a filter in the feedforward path; a neural network in the feedforward path and coupled to the filter, the neural network configured to compensate the backlash by estimating an inverse of the backlash and applying the inverse to an input of the mechanical system; and wherein a tracking error r(k), a backlash estimation error {tilde over (&tgr;)}(k), and a weight estimation error {tilde over (W)}(k) of the neural network are each weighted in the same Lyapunov function.