This example shows how to design a model predictive controller for a linear identified plant model.
This example uses only the measured input and output of the identified model for the model predictive controller plant model.
This example requires a System Identification Toolbox™ license.
Obtain an identified linear plant model.
load dryer2; Ts = 0.08; dry_data = iddata(y2,u2,Ts); dry_data_detrended = detrend(dry_data); plant_idss = ssest(dry_data_detrended,3);
plant_idss is a third-order, identified state-space model that contains one measured input and one unmeasured (noise) input.
Convert the identified plant model to a numeric LTI model.
You can convert the identified model to an ss, tf, or zpk model. For this example, convert the identified state-space model to a numeric state-space model.
plant_ss = ss(plant_idss);
plant_ss contains the measured input and output of plant_idss. The software discards the noise input of plant_idss when it creates plant_ss.
Design a model predictive controller for the numeric plant model.
controller = mpc(plant_ss,Ts);
controller is an mpc object. The software treats:
The measured input of plant_ss as the manipulated variable of controller
The output of plant_ss as the measured output of the plant for controller
To view the structure of the model predictive controller, type controller at the MATLAB® command prompt.