You are on page 1of 1

Model Predictive Control Tutorial

Step 1: Place “MPC_Tutorial” M-file into the Current Directory


(for exampleC:\MATLAB\work).

Step 2: In the MATLAB Command Window enter the following command:


y=MPC_Tutorial(5,100);
This command will instruct MATLAB to design Model Predictive Control algorithm that
has prediction horizon equal to 5 and control weighting equal to 100 and then apply it to
a specific plant.

After some time (which will be proportional to the prediction horizon length) you will be
presented with graphs of output and input variables:

5
Output and reference

-5

-10
0 100 200 300 400 500 600 700 800 900 1000

0.2
Input and constraints

0.1

-0.1

-0.2
100 200 300 400 500 600 700 800 900 1000
Time (sample number)

Step 3: Now re-do the exercise while changing length of the prediction horizon (from 1
to 10) and control weighting (from 1 to 10000) and observe how the responses of output
and input variables change.

For example:

y=MPC_Tutorial(1,1000);

y=MPC_Tutorial(5,1000);

y=MPC_Tutorial(10,1000);

You might also like