The traditional linear quadratic (LQ) controller can give optimal performance to a known linear system with weightings in the time domain, while the frequency shaped LQ (FSLQ) controller is able to provide optimal performance to the same class of systems with weightings in the frequency domain. When the system contains uncertainties, both of these two approaches fail. In this paper, an adaptive controller is proposed to an uncertain mechanical system such that LQ performance can be achieved with weightings in the frequency domain. The function approximation technique is applied to represent the uncertainties into a finite combination of a set of known basis functions. This allows the system to be with various nonlinearities and uncertainties without significant impact on the design procedure. The Lyapunovlike analysis is used to ensure convergence of the system output and boundedness of the internal signals. A dual stage is built to evaluate the performance of the proposed scheme experimentally.