This example shows how to design a model predictive controller using an identified plant model. The internal plant model of the controller uses only the measured input and output of the identified model.
This example requires a System Identification Toolbox™ license.
Load the input/output data for identification.
load dryer2 Ts = 0.08;
iddata object from the input
dry_data = iddata(y2,u2,Ts); dry_data_detrended = detrend(dry_data);
Estimate a linear state-space plant model.
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 component.
You can convert the identified model to an
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 component of
plant_idss when it creates
Design a model predictive controller for the numeric plant model.
controller = mpc(plant_ss,Ts);
-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10. -->The "ControlHorizon" property of the "mpc" object is empty. Assuming 2. -->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
controller is an
mpc object in which:
The measured input of
plant_ss is a manipulated variable.
The output of
plant_ss is a measured output.
To view the structure of the model predictive controller, type
controller at the MATLAB® command prompt.