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:
- run_mpc.m: runs the (S)MPC example (run script or use command "run_mpc()")
- run_examples.m: simple script with one variable to run different (S)MPC examples
- plot_inputs_states.m: runs the (S)MPC example and plots states and the input
- nmpc.m: nonlinear MPC routine developed by Gruene/Pannek  (details: http://numerik.mathematik.uni-bayreuth.de/~lgruene/nmpc-book/matlab_nmpc.html)
SMPC_introduction.pdf  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  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:
- no MPC, no constraint, no uncertainty (MPC input set to 0; only stabilizing feedback matrix K)
- MPC without constraint; no uncertainty
- MPC with constraint; no uncertainty
- MPC with constraint; uncertainty
- 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!
 L. Grüne and J. Pannek. Nonlinear Model Predictive Control. Springer-Verlag, London, 2017.
 T. Brüdigam. (Stochastic) Model Predictive Control - a Simulation Example. arXiv:2101.12020, 2021.
 T. Brüdigam. Safety and Efficiency in Model Predictive Control for Systems with Uncertainty. Dissertation. Technical University of Munich, 2022.