How can I get the ‘y_hat’ and ‘u’ prediction values

Technical Source
2 min readMar 15, 2022

How can I get the ‘y_hat’ and ‘u’ prediction values from my Model Predictive Controller in Simulink in Model Predictive Control Toolbox 3.1.1 (R2009b)?

I have designed my MPC object using the MPC toolbox. I can simulate this with the command SIM but I would like the y_hat and u prediction values at each step along the way.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

It is not possible to get the ‘y_hat’ and ‘u’ prediction values from the MPC controller block in Simulink. This functionality is not available in Model Predictive Control Toolbox 3.1.1 (R2009b). You can, however, get this information via simulation in MATLAB using the MPCMOVE function in a step by step method as outlined below:

% Open-loop system parameters

% True plant and true initial state
sys = ss(tf({1,1,1},{[1 .5 1],[1 1],[.7 .5 1]}));
x0 = [0 0 0 0 0]';

% MPC object setup
Ts = 0.2; % sampling time

% Define type of input signals
sys.InputGroup=struct('Manipulated',1,'Measured',2,'Unmeasured',3);

% Define constraints on manipulated variable
MV = struct('Min', 0, 'Max', 1);
Model = []; % Reset structure Model
Model.Plant = sys;
% Integrator driven by white noise with variance=1000

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.