This paper describes the design procedure of nonlinear dynamical model of a real system-inverted pendulum-cart with pendulum. The aim of the paper is to create a mathematical model based on known constructional, mechanical and electrical characteristics of the physical system. Such a model is linearized into standard linear time-invariant state-space model where the input is motor power voltage and the outputs are cart position and pendulum angle. A linear model is used for discrete-time LQ controller design-state variables are estimated and the cart position is controlled with pendulum in upright metastable position.