Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


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). You can also find a more recent SMPC introduction in chapter 2 of my dissertation [3] where a similar simulation example is analyzed in detail.

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.

[3] T. Brüdigam. Safety and Efficiency in Model Predictive Control for Systems with Uncertainty. Dissertation. Technical University of Munich, 2022.


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