The inverted pendulum on a cart is a nonlinear and inherently unstable benchmark system widely used to evaluate advanced control strategies. This paper presents a Nonlinear Model Predictive Control (NMPC) approach for stabilizing and regulating the position of an inverted pendulum–cart system in the presence of external disturbances and model uncertainties. The nonlinear dynamics are derived using the Euler–Lagrange formulation and discretized for predictive-control implementation. An Extended Kalman Filter (EKF) is employed to estimate the unmeasured velocity states from available position and angle measurements. At each sampling instant, the NMPC controller solves a constrained finite-horizon optimization problem using a Sequential Quadratic Programming (SQP) algorithm while explicitly considering state and input constraints. To highlight the benefits of nonlinear prediction, the proposed controller is compared with a conventional Linear Quadratic Regulator (LQR) under moderately and severely nonlinear benchmark scenarios. Simulation results show that both controllers provide satisfactory performance under moderately nonlinear operating conditions. However, under severe nonlinearities, disturbances, and parameter uncertainties, the LQR controller loses stability, whereas the Nonlinear MPC controller successfully maintains pendulum stabilization and cart-position regulation. The obtained results demonstrate the superior robustness, disturbance-rejection capability, and wider operating range of the proposed Nonlinear MPC strategy, confirming its suitability for controlling nonlinear and unstable dynamical systems.

