Extract Controller

This example shows how to obtain an LTI representation of an unconstrained Model Predictive Control Toolbox™ controller using ss. You can use this to analyze the controller's closed-loop frequency response, etc.

For example, consider the controller designed in Create a Controller Object. To extract the controller, you could type:

MPCss = ss(MPCobj);

You could then construct an LTI model of the closed-loop system using the feedback function (see Control System Toolbox for details) by typing:

CSTRd = c2d(CSTR, MPCss.Ts);
Feedin = 1;
Feedout = 1;
Sign = 1;
CLsys = feedback(CSTRd, MPCss, Feedin, Feedout, Sign);

    Note   The CSTR model must be converted to discrete form with the same control interval as the controller.

Recall that the CSTR plant has two inputs and two outputs. The first input is the manipulated variable and the other is an unmeasured disturbance. The first output is measured for feedback and the other is not. The Feedin and Feedout parameters specify the input and output to be used for control. The Sign parameter signifies that the MPC object uses positive feedback, i.e., the measured outputs enter the controller with no sign change. Omission of this would cause the feedback command to use negative feedback by default and would almost certainly lead to an unstable closed-loop system.

You could then type

eig(CLsys)

to verify that all closed-loop poles are within the unit circle, or

bode(CLsys)

to compute a closed-loop Bode plot.

Was this topic helpful?