Skip to content
Switch branches/tags


If you just want to quickly run (S)MPC examples, use 'run_examples.m' and select an MPC mode.

This stochastic Model Predictive Control (SMPC) example consists of 4 matlab files:

SMPC_introduction.pdf [2] serves as a brief introduction to the example and SMPC with probabilistic constraints (chance constraints).

run_mpc.m allows to run predefined MPC modes or to make simple changes to the (SMPC) algorithm (see lines 13 - 68).

The following predefined options exist:

  1. no MPC, no constraint, no uncertainty (MPC input set to 0; only stabilizing feedback matrix K)
  2. MPC without constraint; no uncertainty
  3. MPC with constraint; no uncertainty
  4. MPC with constraint; uncertainty
  5. SMPC with (chance) constraint; uncertainty

If desired, specific parameters can be passed to run_mpc.m as arguments (see line 8).

Constraint tightening is computed in nmpc.m (see lines 430 - 452).

If you find mistakes or have suggestions, feel free to contribute!

[1] L. Grüne and J. Pannek. Nonlinear Model Predictive Control. Springer-Verlag, London, 2017.

[2] T. Brüdigam. (Stochastic) Model Predictive Control - a Simulation Example. arXiv:2101.12020, 2021.


Short example of MPC and specifically stochastic MPC (SMPC) with chance constraints for Matlab.