📄 ch5_1.m
字号:
% example for function scmpc
% Set up the model and calculate its step response.
g11=poly2tfd(12.8,[16.7 1],0,1);
g21=poly2tfd(6.6,[10.9 1],0,7);
g12=poly2tfd(-18.9,[21.0 1],0,3);
g22=poly2tfd(-19.4,[14.4 1],0,3);
delt=3; ny=2;
imod=tfd2mod(delt,ny,g11,g21,g12,g22);
pmod=imod; % No plant/model mismatch
P=6; % Prediction horizon.
M=2; % Number of moves (input horizon).
% Simulate the unconstrained closed-loop response for a unit step in
% the y2 setpoint
tend=30; r=[0 1]; ywt=[]; uwt=[];
[y,u]=scmpc(pmod,imod,ywt,uwt,M,P,tend,r);
figure,plotall(y,u,delt)
% Simulate the closed-loop response for a unit step in
% the setpoint for y2 with input constraints
ulim=[-inf -0.15 inf inf 0.1 100];
ylim=[];
[y,u]=scmpc(pmod,imod,ywt,uwt,M,P,tend,r,ulim);
figure,plotall(y,u,delt)
% Add output constaints
ulim=[-inf -0.15 inf inf 0.1 100];
ylim=[0 0 inf inf];
[y,u]=scmpc(pmod,imod,ywt,uwt,M,P,tend,r,ulim,ylim);
figure,plotall(y,u,delt)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -