30 January 2018 2 653 Report

Hi, I'd like to regulate an output of a second-order system using MPC. But I always get a result with a huge undershoot. Could anyone let me know how to remove this undershoot? I've changed weight matrices and prediction/control horizons, but still failed to get a good result. Below is the MATLAB code I've made. Thank you.

clear all; clc;

A=[1 1;0 1];

B=[0.5;1];

C=[1 0];

D=zeros(1,1);

IC=[1;0];

Ts=0.1;

SYS=ss(A,B,C,D,Ts);

MSYS = minreal(SYS);

np=10; % prediction horizon

nc=4; % control horizon

mpcobj=mpc(MSYS,Ts,np,nc);

Q=1.e+3;

R=1.e+0;

mpcobj.Weights.OutputVariables={Q};

mpcobj.Weights.ManipulatedVariables={R};

Tstop=20;

Tf=round(Tstop/Ts);

r=zeros(Tf,1);

options=mpcsimopt(mpcobj);

options.PlantInitialState=IC;

[y,t,u]=sim(mpcobj,Tf,r,options);

figure;

subplot(1,2,1);plot(t,u);xlabel('Time');ylabel('Control');

subplot(1,2,2);plot(t,y);xlabel('Time');ylabel('Output');

More David Cho's questions See All
Similar questions and discussions