View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
MPC Tutorial I: Dynamic Matrix Control

5.0 | 4 ratings Rate this file 49 Downloads (last 30 days) File Size: 28 KB File ID: #19479 Version: 1.0
image thumbnail

MPC Tutorial I: Dynamic Matrix Control


Yi Cao (view profile)


07 Apr 2008 (Updated )

A tutorial for beginners to learn dynamic matrix control

| Watch this File

File Information

This is the first part of the planned series for Model Predictive Control (MPC) tutorials.

Dynamic Matrix Control is the first MPC algorithm developed in early 1980s. It is probably also the most widely used MPC algorithm in industry due to the fact that its internal model, the step response model is easy to obtain in an industrial process.

The package provides a dmc function to perform dynamic matrix control and to show the principal of DMC. An example file is included to show how the dmc function can be used to solve a control problem. It only uses basic MATLAB commands. No any other toolboxe is required.


This file inspired Mpc: Multivariable Constrained State Space Example, Mpc Tutorial Iv: Dmc Simulink Block And Example, and Mpc Tutorial Ii: Multivariable And State Space Mpc V2.0.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (14)
22 Feb 2015 sam

sam (view profile)


Comment only
16 Sep 2014 Abhishek

I keep getting an error Maximum Recursion Limit 0f 500 Reached.
I changed it but to 750 Matlab shuts itself down.
How to fix this problem?

Comment only
13 Feb 2014 Hassan

Hassan (view profile)

17 Nov 2012 Sarav

Sarav (view profile)


Can anyone tell how to calculate the step response co-efficients from step test data?
how can i fix the prediction and control horizons?

thx in advance.

Comment only
01 Oct 2012 Sarav

Sarav (view profile)

thx matija, i got it
thank you very much Mr.Yi Cao
for this nice tutorial

Comment only
01 Oct 2012 matija

matija (view profile)

Function "filter" is digital filter which takes coefficients of discrete transfer function polynomial. To get digital filter approximation of continuous filter with transfer function "1/(1+T*s)" and sampling period Ts use coefficients p.a=exp(-Ts/T) ,b=[0,p.a], a=[1,-p.a].

Comment only
30 Sep 2012 Sarav

Sarav (view profile)

thx, matija
actually i dont have any idea on how filter works, i tried to understand the help file in matlab, but i coudnt. Is there any other alternate for filter to this particular application.

Comment only
29 Sep 2012 matija

matija (view profile)

Reference trajectory is generated with first order filter. The initial condition of filter is initialized to p.y and then the set point is filtered so you get "smooth" transition of reference trajectory from current PV to desired SP.

Comment only
28 Sep 2012 Sarav

Sarav (view profile)

hi can anyone pls explain the following line
w=filter([0 (1-p.a)],[1 -p.a],ref,p.y)

Comment only
24 Jan 2012 Mr Smart

06 Oct 2011 matija

matija (view profile)

I got it. The plant has 3 samples of delay, but you only used 2 for generating So[g1,g2...]'.

Thanks for this nice tutorial.

Comment only
05 Oct 2011 matija

matija (view profile)


I noticed that in Camacho's Model Predictive Control G is built like:

however it seems like here in dmc.m it is built like:

Is that a flaw or am I missing something?

The filter function produces y=[y0,y1, ...]', right?
And since input is X=[1,1,1, ...]' we could say that y=g=[g0,g1, ...]' and according to Camacho we would use g(2:P+1) for building G but in mpc.m it is used p.sp=(1:P) which would be g(1:P) in books notation.

Comment only
05 Apr 2009 V. Poor

28 Apr 2008 Haryanto Ade

This is a good tutorial and best. It make clear understanding of MPC.

Let continue the tutorial, please!! Thanks alot.

07 Apr 2008

Update the html file.

Contact us