The inverted pendulum is an inherently unstable and nonlinear dynamic system which is used to verify the feasibility of nonlinear control theories. This study aims to build up a dynamic model of a rotary inverted pendulum and design controllers in which the optimal control design method based on linear dynamic model and the sliding mode control method based on nonlinear dynamic model are respectively adopted.Moreover, the LabVIEW is used to implement the controller design and evaluate the performance of two controller designs for comparison.