MPC-连续性模型离散化函数

27 篇文章 5 订阅
function [Phi_Phi,Phi_F,Phi_R,A_e, B_e,C_e]=mpcgain(Ap,Bp,Cp,Nc,Np);
%Nc control horizon
%Np prediction horizon
%program created for assignment number 2
[m1,n1]=size(Cp);
[n1,n_in]=size(Bp);
%nl-- dimension of the state variables;
%ml-- number of outputs;
%n_in-- number of inputs.
%%%%%%%%%%%%%%%%
%Augment state equations
%%%%%%%%%%%%%%%%
A_e=eye(n1+m1,n1+m1); 
A_e(1:n1,1:n1)=Ap;
A_e(n1+1:n1+m1,1:n1)=Cp*Ap;

B_e=zeros(n1+m1,n_in);
B_e(1:n1,:)=Bp;
B_e(n1+1:n1+m1,:)=Cp*Bp;
C_e=zeros(m1,n1+m1);
C_e(:,n1+1:n1+m1)=eye(m1,m1);
%dimension of the extended state space
n=n1+m1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h(1,:)=C_e;   %scalar for single-input and single-output system
F(1,:)=C_e*A_e;   % row vector (1xn) one row all column 
for kk=2:Np
    h(kk,:)=h(kk-1,:)*A_e;   
    F(kk,:)= F(kk-1,:)*A_e;
end
v=h*B_e;
Phi=zeros(Np,Nc);  %declare the dimension of Phi
Phi(:,1)=v;        % first column
for i=2:Nc
   Phi(:,i)=[zeros(i-1,1);v(1:Np-i+1,1)];  %Toplitz matrix
end
BarRs=ones(Np,1);
Phi_Phi= Phi'*Phi;
Phi_F= Phi'*F;
Phi_R=Phi'*BarRs;

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值