autoQR: Automatic Selection of Q and R in LQR controller

The script in this upload automate the Q and R weighting matrices selection in LQR controller design.
133 Downloads
Updated 23 Jan 2024

View License

The Linear Quadratic Regulator (LQR) controllers are powerful tools for controlling linear time-invariant systems. However, the choice of the weighting matrices (Q and R) in the cost function has a significant impact on the controller's behavior. For intance, the Q matrix penalizes the errors in each state variable, while the R matrix determines the importance of minimizing the control effort. A higher value in Q for a particular state indicates that minimizing the deviation of that state from the reference is more critical. Conversely, a smaller value implies that deviations in that state are less significant. Likewise, A higher value in R for a particular control input implies a higher penalty for using that input. This encourages the controller to use control inputs efficiently and avoid unnecessary or excessive control effort.
Thus we try to automated the selection of this Matrices in the uploaded script. The script requires the state space matrices; A, B and C as input and compute the values of Q and R suitable for your LQR controller design.
you can read more about this in the following conference paper: https://ieeexplore.ieee.org/document/10380869

Cite As

Salawudeen Ahmed Tijani (2026). autoQR: Automatic Selection of Q and R in LQR controller (https://www.mathworks.com/matlabcentral/fileexchange/158181-autoqr-automatic-selection-of-q-and-r-in-lqr-controller), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0.0