声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3614|回复: 4

[编程技巧] 您好,我在仿真一个LMI,总提示dec2mat这个函数错误。

[复制链接]
发表于 2015-5-10 10:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
您好,我在仿真一个LMI,总提示dec2mat这个函数错误,我觉得是LMI没有可行解导致的。做的方向是部分未知转移概率的Markov跳跃系统H-inf滤波器的设计。这是程序,麻烦帮我看一下,谢谢了。
clear all
A{1}=[2.72 -1.40;0.80 -0.80];
A{2}=[1.58 -0.36;0.80 -1.12];
A{3}=[0.76 -0.28;0.80 -0.96];
A{4}=[1.28 -0.38;0.80 -0.88];
B{1}=[2;1];
B{2}=[5;-6];
B{3}=[1;1];
B{4}=[0.8;-1];
C{1}=[0.1 0];
C{2}=C{1};
C{3}=C{1};
C{4}=C{1};
D{1}=0.2;
D{2}=0.2;
D{3}=0.2;
D{4}=0.2;
H{1}=[0.1 0.1];
H{2}=H{1};
H{3}=H{1};
H{4}=H{1};
LMD=[-1.3  0.2  0.8  0.3;
      0.3 -0.9  0.3  0.3;
      0.6  0.6 -1.5  0.3;
      0.4  0.2  0.6 -1.2];
L{1}=LMD(1,1)+LMD(1,2);
L{2}=LMD(2,3)+LMD(2,4);
L{3}=LMD(3,1)+LMD(3,3);
L{4}=LMD(4,4);
setlmis([])
for k=1:1:4
            X1{k}=lmivar(1,[2 1]);
            X2{k}=lmivar(1,[2 1]);
            Y{k}=lmivar(2,[2 2]);   
            Z{k}=lmivar(2,[2 1]);
            W{k}=lmivar(2,[1 2]);      
end
r_square=lmivar(1,[1 1]);
i=1;
k=1;
%**********************11111111***********
% Conditions for Known parts
Fir{k}=newlmi;
lmiterm([ Fir{k} 1 1 X1{i}],A{i},1+L{i},'s');
lmiterm([ Fir{k} 1 1 X1{i}],LMD(i,1),1);
lmiterm([ Fir{k} 1 2 -Z{i}],C{i}',1+L{i});
lmiterm([ Fir{k} 1 3 X1{i}],1,B{i});
lmiterm([ Fir{k} 1 4 0],H{i}');
lmiterm([ Fir{k} 1 5 X1{2}],sqrt(LMD(i,2)),1);
lmiterm([ Fir{k} 2 2 Y{i}],1,1+L{i},'s');
lmiterm([ Fir{k} 2 2 X2{i}],LMD(i,1),1);
lmiterm([ Fir{k} 2 3 Z{i}],1,D{i});
lmiterm([-Fir{k} 2 4 -W{i}],1,1);
lmiterm([ Fir{k} 2 6 X2{2}],sqrt(LMD(i,2)),1);
lmiterm([-Fir{k} 3 3 r_square],1,1);
lmiterm([-Fir{k} 4 4 0],1);
lmiterm([-Fir{k} 5 5 X1{2}],1,1);
lmiterm([-Fir{k} 6 6 X2{2}],1,1);
% conditions for unknown parts
Sen{k}=newlmi;
lmiterm([ Sen{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen{k} 1 1 X1{3}],1,1);
lmiterm([ Sen{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen{k} 2 2 X2{3}],1,1);
Sen1{k}=newlmi;
lmiterm([ Sen1{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen1{k} 1 1 X1{4}],1,1);
lmiterm([ Sen1{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen1{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen1{k} 2 2 X2{4}],1,1);
%**********************************
i=i+1;
k=k+1;
%****************     2222222    ******
% Conditions for Known parts
Fir{k}=newlmi;
lmiterm([ Fir{k} 1 1 X1{i}],A{i},1+L{i},'s');
lmiterm([ Fir{k} 1 2 -Z{i}],C{i}',1+L{i});
lmiterm([ Fir{k} 1 3 X1{i}],1,B{i});
lmiterm([ Fir{k} 1 4 0],H{i}');
lmiterm([ Fir{k} 1 5 X1{3}],sqrt(LMD(i,3)),1);
lmiterm([ Fir{k} 1 7 X1{4}],sqrt(LMD(i,4)),1);
lmiterm([ Fir{k} 2 2 Y{i}],1,1+L{i},'s');
lmiterm([ Fir{k} 2 3 Z{i}],1,D{i});
lmiterm([-Fir{k} 2 4 -W{i}],1,1);
lmiterm([ Fir{k} 2 6 X2{3}],sqrt(LMD(i,3)),1);
lmiterm([ Fir{k} 2 8 X2{4}],sqrt(LMD(i,4)),1);
lmiterm([-Fir{k} 3 3 r_square],1,1);
lmiterm([-Fir{k} 4 4 0],1);
lmiterm([-Fir{k} 5 5 X1{3}],1,1);
lmiterm([-Fir{k} 6 6 X2{3}],1,1);
lmiterm([-Fir{k} 7 7 X1{4}],1,1);
lmiterm([-Fir{k} 8 8 X2{4}],1,1);
% conditions for unknown parts
Sen{k}=newlmi;
lmiterm([ Sen{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen{k} 1 1 X1{1}],1,1);
lmiterm([ Sen{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen{k} 2 2 X2{1}],1,1);
Sen1{k}=newlmi;
lmiterm([ -Sen1{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ -Sen1{k} 1 1 X1{2}],1,1);
lmiterm([ -Sen1{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ -Sen1{k} 2 2 Y{i}],1,1,'s');
lmiterm([ -Sen1{k} 2 2 X2{2}],1,1);
%************************************************
i=i+1;
k=k+1;
%****************     3333     *****************
% Conditions for Known parts
Fir{k}=newlmi;
lmiterm([ Fir{k} 1 1 X1{i}],A{i},1+L{i},'s');
lmiterm([ Fir{k} 1 1 X1{i}],LMD(i,3),1);
lmiterm([ Fir{k} 1 2 -Z{i}],C{i}',1+L{i});
lmiterm([ Fir{k} 1 3 X1{i}],1,B{i});
lmiterm([ Fir{k} 1 4 0],H{i}');
lmiterm([ Fir{k} 1 5 X1{1}],sqrt(LMD(i,1)),1);
lmiterm([ Fir{k} 2 2 Y{i}],1,1+L{i},'s');
lmiterm([ Fir{k} 2 2 X2{i}],LMD(i,3),1);
lmiterm([ Fir{k} 2 3 Z{i}],1,D{i});
lmiterm([-Fir{k} 2 4 -W{i}],1,1);
lmiterm([ Fir{k} 2 6 X2{1}],sqrt(LMD(i,1)),1);
lmiterm([-Fir{k} 3 3 r_square],1,1);
lmiterm([-Fir{k} 4 4 0],1);
lmiterm([-Fir{k} 5 5 X1{1}],1,1);
lmiterm([-Fir{k} 6 6 X2{1}],1,1);
% conditions for unknown parts
Sen{k}=newlmi;
lmiterm([ Sen{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen{k} 1 1 X1{4}],1,1);
lmiterm([ Sen{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen{k} 2 2 X2{4}],1,1);
Sen1{k}=newlmi;
lmiterm([ Sen1{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen1{k} 1 1 X1{2}],1,1);
lmiterm([ Sen1{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen1{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen1{k} 2 2 X2{2}],1,1);
%************************************************
i=i+1;
k=k+1;
%****************     4444    ****************
% Conditions for Known parts
Fir{k}=newlmi;
lmiterm([ Fir{k} 1 1 X1{i}],A{i},1+L{i},'s');
lmiterm([ Fir{k} 1 1 X1{i}],LMD(i,4),1);
lmiterm([ Fir{k} 1 2 -Z{i}],C{i}',1+L{i});
lmiterm([ Fir{k} 1 3 X1{i}],1,B{i});
lmiterm([ Fir{k} 1 4 0],H{i}');
lmiterm([ Fir{k} 2 2 Y{i}],1,1+L{i},'s');
lmiterm([ Fir{k} 2 2 X2{i}],LMD(i,4),1);
lmiterm([ Fir{k} 2 3 Z{i}],1,D{i});
lmiterm([-Fir{k} 2 4 -W{i}],1,1);
lmiterm([-Fir{k} 3 3 r_square],1,1);
lmiterm([-Fir{k} 4 4 0],1);
% conditions for unknown parts
Sen{k}=newlmi;
lmiterm([ Sen{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen{k} 1 1 X1{1}],1,1);
lmiterm([ Sen{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen{k} 2 2 X2{1}],1,1);
Sen1{k}=newlmi;
lmiterm([ Sen1{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen1{k} 1 1 X1{2}],1,1);
lmiterm([ Sen1{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen1{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen1{k} 2 2 X2{2}],1,1);
Sen2{k}=newlmi;
lmiterm([ Sen2{k} 1 1 X1{i}],A{i},1,'s');
lmiterm([ Sen2{k} 1 1 X1{3}],1,1);
lmiterm([ Sen2{k} 1 2 -Z{i}],C{i}',1);
lmiterm([ Sen2{k} 2 2 Y{i}],1,1,'s');
lmiterm([ Sen2{k} 2 2 X2{3}],1,1);
%*******************************************
lmisys=getlmis;
[tmin,xfeas]=feasp(lmisys);
n=decnbr(lmisys);
c=zeros(n,1);
for i=1:n
    [RRi]=defcx(lmisys,i,r_square);
    c(i)=RRi;
end
[copt,RRopt]=mincx(lmisys,c);
RR=dec2mat(lmisys,RRopt,r_square);
RRR=sqrt(RR)
for i=1:4
    Xx1{i}=dec2mat(lmisys,RRopt,X1{i});
    Xx2{i}=dec2mat(lmisys,RRopt,X2{i});
    Yy{i}=dec2mat(lmisys,RRopt,Y{i});
    Zz{i}=dec2mat(lmisys,RRopt,Z{i});
    Ww{i}=dec2mat(lmisys,RRopt,W{i});
    AF{i}=inv(Xx2{i})*Yy{i};
    BF{i}=inv(Xx2{i})*Zz{i};
    CF{i}=Ww{i};
end
AF{1}
AF{2}
AF{3}
AF{4}
BF{1}
BF{2}
BF{3}
BF{4}
CF{1}
CF{2}
CF{3}
CF{4}
%Xx2{1}
%Xx2{2}
%Xx2{3}
%Xx2{4}
%Xx1{1}
%Xx1{2}
%Xx1{3}
%Xx1{4}
%Zz{1}
%Yy{1}
%Ww{1}
save('five_I.mat');
总提示这个错误。
Result:  infeasibility

The LMI constraints were found INFEASIBLE

Error using dec2mat (line 26)
DECVARS must be a vector of length 57

Error in five_I (line 188)
RR=dec2mat(lmisys,RRopt,r_square);

回复
分享到:

使用道具 举报

 楼主| 发表于 2015-5-11 09:19 | 显示全部楼层
论坛里的MATLAB大神呢??
 楼主| 发表于 2015-5-11 17:30 | 显示全部楼层
可行性问题解决了,又来个更棘手的。我现在再做连续系统的H—inf滤波器设计,之前运行的LMI不可行,调完系数之后运行结果是滤波器的增益Bf,和Cf结果是0矩阵,这是怎么回事呀?? p=1.5; A{1}=p*[-0.5 -0.5;1 -1]; A{2}=0.4*[-0.1 -0.33;1 -1.4]; A{3}=1.3*[-0.2 -0.1;1 -1.2]; A{4}=p*[-0.6 -0.23;1 -1.1]; 把A换成上面的矩阵就行了。

点评

额 那现在是解决了 还是没解决啊  详情 回复 发表于 2016-7-5 09:08
发表于 2016-7-4 22:05 | 显示全部楼层
爱雪1314 发表于 2015-5-11 17:30
**** 作者被禁止或删除 内容自动屏蔽 ****

楼主您好,请问您的问题解决了吗,我最近也遇到了类似的问题,可以讨论一下吗
发表于 2016-7-5 09:08 | 显示全部楼层
爱雪1314 发表于 2015-5-11 17:30
**** 作者被禁止或删除 内容自动屏蔽 ****

额  那现在是解决了  还是没解决啊
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-23 06:28 , Processed in 0.084142 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表