An automatic trajectory optimization scheme, which takes the system dynamics into account, is presented in this paper. It is developed for use in conjunction with the rapid-tracking learning control. It optimizes the reference trajectory such that tracking will be speeded up whenever the actuator capability is not fully utilized, and slowed down whenever the actuator would otherwise saturate. This yields not only excellent fast tracking performance but also a new reference trajectory which accommodates the saturation constraint of the control actuator. Application of the proposed strategy in control practice will ease the burden of having to precisely design the timing of a reference trajectory in a tracking control problem. The resulting controlled system is able to precisely track short but highly complex trajectories at the highest speed physically possible. Simulation and experimental results of simultaneously controlling two motors to emulate servoing an x-y table are given to demonstrate the effectiveness of the proposed methodology.