B=[1;5;2];C=[110;011];D=[10;01];
????2运行结果
[P1,n,sP1]=lmivar;[P2,n,sP2]=lmivar;[P3,n,sP3]=lmivar;[P4,n,sP4]=lmivar;[P5,n,sP5]=lmivar;[P0,n,sP0]=lmivar;
al1=0.01;al2=0.01;
x=0;x=0;x=0;xp=0;xp=0;xp=0;
figure,stairs,"k","LineStyle","--"),holdon,stairs,"k","LineStyle","--"),holdon,stairs,"k","LineStyle","--")figure,stairs,"k"),holdon,stairs,"k"),holdon,stairs,"k")
Ts=0.01;t=0:1:600;a=0:0.01:2*pi;u=sin;
L0=-P0opt^*Y0opt;L1=-P1opt^*Y1opt;L2=-P2opt^*Y2opt;L3=-P3opt^*Y3opt;L4=-P4opt^*Y4opt;L5=-P5opt^*Y5opt;
部分代码:
%figure,stairs-x,"k"),holdon,stairs-x,"k"),holdon,stairs-x,"k"),axis;%%ylabel%xlabel
A=[0.950.50.2;-0.9-0.2;00.85];%StablePlant%A=[20.50.2;-0.11-0.2;00.11];%UnstablePlant
LMIs=getlmis;c=[1zeros];
fork=1:600;ifk<=600u_proposed=al1*randn;y_proposed=al2*[randn;randn];elseu_proposed=0;y_proposed=0;endxp=A*xp+B*u+B*u_proposed;yp=C*xp+D*y_proposed;ifrem==0x=*x+B*u+L0*yp;y=C*x;elseifrem==1x=*x+B*u+L1*yp;y=C*x;elseifrem==2x=*x+B*u+L2*yp;y=C*x;elseifrem==3x=*x+B*u+L3*yp;y=C*x;elseifrem==4x=*x+B*u+L4*yp;y=C*x;elseifrem==5x=*x+B*u+L5*yp;y=C*x;enduy_proposed_sum=uy_proposed_sum+u_proposed^2+norm^2;e_proposed_sum=e_proposed_sum+norm-xp)^2;end
subplot;holdon;%gridonstairs-x,"k","LineWidth",0.;axis%set;xlabelylabelboxon
setlmis
C0=S0*C;C1=S1*C;C2=S2*C;C3=S3*C;C4=S4*C;C5=S5*C;D0=S0*D;D1=S1*D;D2=S2*D;D3=S3*D;D4=S4*D;D5=S5*D;
????4Matlab代码实现
S0=[10;01];S1=[00;00];S2=[10;00];S3=[00;01];S4=[10;00];S5=[00;00];
[gamma2,n,sgamma2]=lmivar;
figure%z,zQ1subplot;holdon;%gridonstairs-x,"k","LineWidth",0.;axis%set;xlabelylabelboxon%%figure%v1subplot;holdon;%gridonstairs-x,"k","LineWidth",0.;axis%set;xlabelylabelboxon
set;set;set;set;
[copt,xopt]=mincx;P0opt=dec2mat;Y0opt=dec2mat;P1opt=dec2mat;Y1opt=dec2mat;P2opt=dec2mat;Y2opt=dec2mat;P3opt=dec2mat;Y3opt=dec2mat;P4opt=dec2mat;Y4opt=dec2mat;P5opt=dec2mat;Y5opt=dec2mat;
S1=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)S2=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)S3=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)S4=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)S5=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)S6=newlmi;lmitermlmitermlmitermlmitermlmitermlmitermlmiterm)lmitermlmiterm)
ylabelxlabel
[Y1,n,sY1]=lmivar;[Y2,n,sY2]=lmivar;[Y3,n,sY3]=lmivar;[Y4,n,sY4]=lmivar;[Y5,n,sY5]=lmivar;[Y0,n,sY0]=lmivar;
文章为作者独立观点,不代表股票交易接口观点