MPC MATLAB Examples
Engineering · Educational Implementation
A collection of MATLAB implementations that connect model predictive control theory to quadratic-program formulations and constrained trajectory tracking.
Scope
The examples use a double-integrator model to study trajectory tracking, input and state constraints, and comparisons between MPC and LQR. This is an educational engineering implementation.
Public Implementations
MPC_trajectory_main.m: tracking a time-varying reference.MPC_con_main.m: constrained model predictive control.MPCvsLQR_QP_main.m: MPC and LQR comparison.MPC_Toolbox.m: a MATLAB MPC Toolbox comparison.test/Check_Constraints.m: inspecting constraint satisfaction.test/Check_QP_Transform.m: checking the QP transformation.
Run an Example
The repository documents MATLAB R2020b or later and Optimization Toolbox as requirements. Control System Toolbox is used for system analysis / LQR, and MPC Toolbox is optional for the toolbox comparison.
% From the repository root:
addpath('lib')
addpath('test')
run('MPC_con_main.m')
run('test/Check_Constraints.m')
The scripts expose tracking and constraint behavior for inspection. The website describes the public implementation; it does not report a new benchmark run or hardware experiment.
