This study presents a particle-swarm-optimisation (PSO) approach for selecting the weighting matrices of a discrete Linear Quadratic Regulator (LQR) for stabilisation and cart-position trajectory tracking of an inverted pendulum on a cart. The PSO search minimises the sum of squared cart-position tracking errors (SSE) obtained from nonlinear closed-loop simulation; SSE is the sole optimisation objective. Pendulum-angle deviation, control voltage, settling time, and overshoot are not included in the PSO fitness function. They are reported as post-optimisation performance indicators to assess whether a controller with low SSE also provides an acceptable transient response and actuator demand. The nonlinear cart–pendulum model is linearised about the upright equilibrium for LQR gain synthesis, while the candidate controllers are evaluated using the nonlinear MATLAB/Simulink plant. The resulting controller is tested for upright regulation, sinusoidal tracking, staircase tracking, and weight sensitivity. The simulations show the expected trade-off: increasing the cart-position weight can reduce SSE and shorten the cart transient, whereas increasing the input weight reduces the required voltage but degrades tracking speed. The work provides a transparent SSE-based PSO-LQR workflow for nonlinear simulation of the cart–pendulum system; it does not claim experimental validation or hardware feasibility.
Copyrights © 2026