load step_model;
%------参数初始化-------%
yw=[10 0]; %输出误差加权矩阵
uw=1; %控制量加权矩阵
M=5; %控制时域
r=[1 0]; %设定值
tend=150; %仿真时间
model=plant;
%------控制时域对系统影响-------%
P=5;
Kmpc=mpccon(model,yw,uw,M,P);%求解无约束MPC增益阵
[y1,u1]=mpcsim(plant,model,Kmpc,tend,r);%仿真闭环曲线
P=10;
Kmpc=mpccon(model,yw,uw,M,P);
[y2,u2]=mpcsim(plant,model,Kmpc,tend,r);
P=20;
Kmpc=mpccon(model,yw,uw,M,P);
[y3,u3]=mpcsim(plant,model,Kmpc,tend,r);
P=30;
Kmpc=mpccon(model,yw,uw,M,P);
[y4,u4]=mpcsim(plant,model,Kmpc,tend,r);
figure(1);
%绘制闭环输出曲线%
subplot(2,2,1);
plot(0:Ts:tend,y1(:,1));
hold on;
plot(0:Ts:tend,y1(:,2),'r');
grid on;
xlabel('time(s)');
legend('y1','y2');
title('Output P=5');
%绘制控制输入曲线%
subplot(2,2,2);
plot(0:Ts:tend,u1);
grid on;
legend('u');
xlabel('time(s)');
title('Manipulated Variables');
%绘制闭环输出曲线%
subplot(2,2,3);
plot(0:Ts:tend,y2(:,1));
hold on;
plot(0:Ts:tend,y2(:,2),'r');
grid on;
xlabel('time(s)');
legend('y1','y2');
title('Output P=10');
axis([0 50 -5 2]);
%绘制控制输入曲线%
subplot(2,2,4);
plot(0:Ts:tend,u2);
grid on;
legend('u');
xlabel('time(s)');
title('Manipulated Variables');
figure(2);
%绘制闭环输出曲线%
subplot(2,2,1);
plot(0:Ts:tend,y3(:,1));
hold on;
plot(0:Ts:tend,y3(:,2),'r');
grid on;
xlabel('time(s)');
legend('y1','y2');
title('Output P=20');
axis([0 50 -5 2]);
%绘制控制输入曲线%
subplot(2,2,2);
plot(0:Ts:tend,u3);
grid on;
legend('u');
xlabel('time(s)');
title('Manipulated Variables');
%绘制闭环输出曲线%
subplot(2,2,3);
plot(0:Ts:tend,y4(:,1));
hold on;
plot(0:Ts:tend,y4(:,2),'r');
grid on;
xlabel('time(s)');
legend('y1','y2');
title('Output P=30');
axis([0 50 -5 2]);
%绘制控制输入曲线%
subplot(2,2,4);
plot(0:Ts:tend,u4);
grid on;
legend('u');
xlabel('time(s)');
title('Manipulated Variables');

我虽横行却不霸道
- 粉丝: 114
最新资源
- 逻辑与信息教学的新方法探讨
- 互联网思维模式下的新媒体运营策略探索.docx
- 互联网+智能制造.pptx
- 工程科技自动化培训班.ppt
- 大数据下的网络思想政治教育.docx
- Android移动应用内聚合支付平台的分析研究与设计方案.doc
- 试论计算机安全危害的特点与对策.docx
- 互联网医疗行业发展趋势分析:政策日益明朗-互联网+医疗健康服务蓬.docx
- 配电网自动化实用技术手册基础知识框架(一部分).doc
- 智能校园安防监控物联网系统设计.docx
- 计算机软件开发中的分层技术与实施要点分析.docx
- 50年机器人学厨进化史:用大数据传承美食记忆.docx
- 谈大数据时代的信息与计算科学.docx
- ZIGBEE-ON-WINDOWS-MOBILEZIGBEE模块的设计制作.doc
- 智能化技术应用于电气工程自动化控制的途径研究.docx
- 电子商务与物流实验分析报告1.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



评论2