clc
clear all
close all
%% system page 85
A{1}=[-1.9 -1;2 1];
A{2}=[-0.08 0.8;0.58 0.69];
B{1}=[0.26;0.92];
B{2}=[-1;0.21];
% A{1}=[0 1;-0.59 2.18];
% A{2}=[0 1;-0.36 2.26];
% B{1}=[0;-0.603];
% B{2}=[0;-1.12];
W=eye(1);R=eye(1);
C=[1 0];
%% LMI
setlmis([])
X=lmivar(1,[2 1]) ;
for i=1:2
M{i}=lmivar(2,[1 2]) ;
end
% n=1;
% for i=1:2
% newlmi
% lmiterm([-n 1 1 X] , 1 , 1) ;
% lmiterm([-n 2 1 X] , A{i} , 1) ;
% lmiterm([-n 2 1 M{i}] , -B{i} , 1) ;
% lmiterm([-n 2 2 X], 1,1) ;
% n=n+1;
% end
% n=1;
% for i=1:2
% for j=1:2
% if j>i
% newlmi
% lmiterm([-n 1 1 X] , 1 , 1) ;
% lmiterm([-n 2 1 X], .5.*A{i} ,1)
% lmiterm([-n 2 1 X], .5.*A{j} , 1);
% lmiterm([-n 2 1 M{i}], -.5.*B{j},1) ;
% lmiterm([-n 2 1 M{j}],-.5.*B{i},1) ;
% lmiterm([-n 2 2 X],1,1);
% end
% end
% n=n+1;
% end
n=1;
for i=1:2
for j=1:2
newlmi
lmiterm([-n 1 1 X],1,1)
lmiterm([-n 2 1 X],A{i} , 1)
lmiterm([-n 2 1 M{j}],-B{i} ,1)
lmiterm([-n 2 2 X],1 ,1)
n=n+1;
end
end
lmisys=getlmis;
[tmin,xfeas]=feasp(lmisys)
clc
M1=dec2mat(lmisys,xfeas,M{1})
M2=dec2mat(lmisys,xfeas,M{2})
X=dec2mat(lmisys,xfeas,X)
F1=M1*inv(X)
F2=M2*inv(X)
P=inv(X)
% xfeas=dec2mat(lmisys,xfeas,X)
% for i=1:2
% mfeas=dec2mat(lmisys,xfeas,M{i})
% end
%%
x1(1)=1;x2(1)=-.5;
% A1=[0 1;-0.59 2.18];
% A2=[0 1;-0.36 2.26];
% B1=[0;-0.603];
% B2=[0;-1.12];
A1=[-1.9 -1;2 1];
A2=[-0.08 0.8;0.58 0.69];
B1=[0.26;0.92];
B2=[-1;0.21];
G1=A1-B1*F1;G2=A2-B2*F2;
C1=[1 0];C2=[1 0];W=eye(1);R=eye(1);J=0;
my_fis=newfis('TS','sugeno');
my_fis=addvar(my_fis,'input','x2',[0 1]);
my_fis=addmf(my_fis,'input',1,'M1','trapmf',[0 0 0.3 0.6]);
my_fis=addmf(my_fis,'input',1,'M2','trapmf',[0.4 0.7 1 1]);
my_fis=addvar(my_fis,'output','A11',[-10 10]);
my_fis=addmf(my_fis,'output',1,'a11','constant',A1(1,1));
my_fis=addmf(my_fis,'output',1,'a11','constant',A2(1,1));
my_fis=addvar(my_fis,'output','A12',[-10 10]);
my_fis=addmf(my_fis,'output',2,'a12','constant',A1(1,2));
my_fis=addmf(my_fis,'output',2,'a12','constant',A2(1,2));
my_fis=addvar(my_fis,'output','A21',[-10 10]);
my_fis=addmf(my_fis,'output',3,'a21','constant',A1(2,1));
my_fis=addmf(my_fis,'output',3,'a21','constant',A2(2,1));
my_fis=addvar(my_fis,'output','A22',[-10 10]);
my_fis=addmf(my_fis,'output',4,'a22','constant',A1(2,2));
my_fis=addmf(my_fis,'output',4,'a22','constant',A2(2,2));
my_fis=addvar(my_fis,'output','B1',[-10 10]);
my_fis=addmf(my_fis,'output',5,'b1','constant',B1(1));
my_fis=addmf(my_fis,'output',5,'b1','constant',B2(1));
my_fis=addvar(my_fis,'output','B2',[-10 10]);
my_fis=addmf(my_fis,'output',6,'b2','constant',B1(2));
my_fis=addmf(my_fis,'output',6,'b2','constant',B2(2));
my_fis=addvar(my_fis,'output','C1',[-10 10]);
my_fis=addmf(my_fis,'output',7,'c1','constant',C1(1));
my_fis=addmf(my_fis,'output',7,'c1','constant',C2(1));
my_fis=addvar(my_fis,'output','C2',[-10 10]);
my_fis=addmf(my_fis,'output',8,'c2','constant',C1(2));
my_fis=addmf(my_fis,'output',8,'c2','constant',C2(2));
my_fis=addvar(my_fis,'output','F1',[-10 10]);
my_fis=addmf(my_fis,'output',9,'f1','constant',F1(1));
my_fis=addmf(my_fis,'output',9,'f1','constant',F2(1));
my_fis=addvar(my_fis,'output','F2',[-10 10]);
my_fis=addmf(my_fis,'output',10,'f2','constant',F1(2));
my_fis=addmf(my_fis,'output',10,'f2','constant',F2(2));
Rulelist = [1 1 1 1 1 1 1 1 1 1 1 1 1;2 2 2 2 2 2 2 2 2 2 2 1 1];
my_fis = addrule(my_fis, Rulelist);
V(1)=[x1(1);x2(1)]'*P*[x1(1);x2(1)];
n=50;x=[x1;x2];
for i=2:n
G=evalfis(x1(i-1),my_fis);
A=[G(1) G(2); G(3) G(4)];
B=[G(5);G(6)];
C=[G(7) G(8)];
F=[G(9) G(10)];
x(:,i)=(A+B*F)*x(:,i-1);
x1(i)=x(1,i);
x2(i)=x(2,i);
u(i)=F*x(:,i);
V(i)=[x1(i);x2(i)]'*P*[x1(i);x2(i)];
J=J+x(:,i)'*C'*W*C*x(:,i)+x(:,i)'*F'*R*F*x(:,i);
end
m=0:n-1;
figure
subplot(2,1,1)
plot(m,x1,'marker','.')
grid on
xlabel('sample time')
ylabel('x_1')
subplot(2,1,2)
plot(m,x2,'marker','.')
grid on
xlabel('sample time')
ylabel('x_2')
figure
subplot(2,1,1)
plot(m,V,'marker','.')
ylabel('Lyapunov Function')
grid on
xlabel('sample time')
subplot(2,1,2)
plot(m,u,'marker','.')
ylabel('control signal')
grid on
xlabel('sample time')
没有合适的资源?快使用搜索试试~ 我知道了~
LMI.rar_Inequality_LMI_Linear matrix_linear inequality
共5个文件
m:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 54 浏览量
2022-09-23
18:21:38
上传
评论 1
收藏 4KB RAR 举报
温馨提示
LMI_Training for Linear Matrix Inequality
资源推荐
资源详情
资源评论
收起资源包目录
LMI.rar (5个子文件)
My_LMI_Q5.m 4KB
My_LMI_Decay_Q5.m 2KB
LMI_Training.m 682B
gevpinlmi.m 2KB
feng_example.m 4KB
共 5 条
- 1
资源评论
weixin_42653672
- 粉丝: 93
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功