Hello, Johan Löfberg .
I'm new to yalmip, and,I want to solve following LMI, but i meet a problem:And the result is:
Error using sdpvar/mtimes (line 502)
Inner matrix dimensions must agree.
Error in yalamp (line)
V =V + set([X*A1-W1*C+A1'*X-C'*W1'-2*u*X 0;0 -X*A1+W1*C-A1'*X+C'*W1'+2*uu*X]<0);
Thank you very much.
Hi johan,
Thanks for your reply,this simulation task is based on article of Bahlol in attachment
I tried to correct my code as follows:
Matlab : (R2012a)
YALMIP version: R20131002 ,and SeDuMi_1_3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;clc
Ls=0.462;Lr=0.462;Lsr=0.4402;Rs=5.72;Rr=4.2;Dm=0.0049;Rm=0.003;np=2;
Lm=Lsr;
sigma=1-(Lsr^2)/(Ls*Lr);
Tr=Lr/Rr;
gama=(Rs/(Ls*sigma))+((Lsr^2)/(Ls*sigma*Lr*Tr))
a1=(np*Lsr)/(Dm*Lr);
a2=-Rm/Dm;
a3=-1/Dm;
a4=-1/Tr;
a5=Lsr/Tr;
a6=Lsr/(Tr*sigma*Ls*Lr);
a7=(np*Lsr)/(sigma*Ls*Lr);
a8=1/(sigma*Ls);
u=-10000;uu=-200;b=100;
A01=[-gama 0 a6 0 ;0 -gama 0 a6 ;a5 0 a4 0 ;0 a5 0 a4 ]
A11=[0 0 0 a7 ;0 0 -a7 0 ;0 0 0 -np ;0 0 np 0]
A21=[0 1 0 0 ;-1 0 0 0 ;0 0 0 1 ;0 0 -1 0]
B=[a8 0;0 a8;0 0;0 0]
C=[1 0 0 0;0 1 0 0]
D=[0 0;0 0]
wmax=300;wmin=100;wsmax=600;wsmin=200;
A1=A01+300*A11+600*A21;
A2=A01+100*A11+600*A21;
A3=A01+300*A11+200*A21;
A4=A01+100*A11+200*A21;
X=sdpvar(4,4);
W1=sdpvar(4,2);
W2=sdpvar(4,2);
W3=sdpvar(4,2);
W4=sdpvar(4,2);
F = [X > 0];
F =[F,[X*A1-W1*C+A1'*X-C'*W1'-2*u*X zeros(4,4);zeros(4,4) -X*A1+W1*C-A1'*X+C'*W1'+2*uu*X]<0];
F =[F,[-2*b*X X*A1-W1*C+A1'*X-C'*W1';-(X*A1-W1*C+A1'*X-C'*W1')' -2*b*X ]<0];
F =[F,[X*A2-W2*C+A2'*X-C'*W2'-2*u*X zeros(4,4);zeros(4,4) -X*A2+W2*C-A2'*X+C'*W2'+2*uu*X]<0];
F =[F,[-2*b*X X*A2-W2*C+A2'*X-C'*W2';-(X*A2-W2*C+A2'*X-C'*W2')' -2*b*X ]<0];
F =[F,[X*A3-W3*C+A3'*X-C'*W3'-2*u*X zeros(4,4);zeros(4,4) -X*A3+W3*C-A3'*X+C'*W3'+2*uu*X]<0];
F =[F,[-2*b*X X*A3-W3*C+A3'*X-C'*W3';-(X*A3-W3*C+A3'*X-C'*W3')' -2*b*X ]<0];
F =[F,[X*A4-W4*C+A4'*X-C'*W4'-2*u*X zeros(4,4);zeros(4,4) -X*A4+W4*C-A4'*X+C'*W4'+2*uu*X]<0];
F =[F,[-2*b*X X*A4-W4*C+A4'*X-C'*W4';-(X*A4-W4*C+A4'*X-C'*W4')' -2*b*X ]<0];
solvesdp(F,-trace(X))
% solvesdp(F);
X=double(X);
W1=double(W1);
W2=double(W2);
W3=double(W3);
W4=double(W4);
L1=inv(X)*W1
L2=inv(X)*W2
L3=inv(X)*W3
L4=inv(X)*W4
%%%%%%%%%%%%%%%%%%%%%%%
And the result is:
The coefficient matrix is not full row rank, numerical problems may occur.
SeDuMi 1.3 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, theta = 0.250, beta = 0.500
eqs m = 42, order n = 293, dim = 529, blocks = 6
nnz(A) = 1314 + 0, nnz(ADA) = 996, nnz(L) = 519
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 4.03E+07 0.000
1 : -1.59E-04 9.10E+06 0.000 0.2260 0.9000 0.9000 1.00 1 1 3.5E+04
2 : -1.45E-04 7.55E+05 0.000 0.0829 0.9900 0.9900 1.00 1 1 2.9E+03
3 : -4.05E-06 4.23E+04 0.000 0.0561 0.9900 0.9900 1.00 1 1 1.6E+02
4 : -1.93E-09 8.54E+00 0.000 0.0002 0.9999 0.9999 1.00 1 1 3.3E-02
5 : -4.24E-15 2.23E-05 0.000 0.0000 1.0000 1.0000 1.00 1 1 7.8E-08
6 : -2.96E-16 1.78E-06 0.000 0.0797 0.9900 0.9900 1.15 2 2 5.5E-09
7 : -5.05E-17 1.59E-06 0.000 0.8913 0.9000 0.9000 15.50 2 3 9.4E-10
iter seconds digits c*x b*y
7 0.5 7.1 0.0000000000e+00 -5.0510257927e-17
|Ax-b| = 1.8e-09, [Ay-c]_+ = 4.3E-15, |x|= 6.0e+00, |y|= 3.9e-13
Detailed timing (sec)
Pre IPM Post
5.000E-01 8.300E-01 6.001E-02
Max-norms: ||b||=1, ||c|| = 0,
Cholesky |add|=0, |skip| = 4, ||L.L|| = 13429.7.
ans =
yalmiptime: 1.1000
solvertime: 1.4500
info: 'Successfully solved (SeDuMi-1.3)'
problem: 0
L1 =
1.0e+04 *
0.5766 -1.0693
1.0412 -0.5629
0.6143 -2.0058
1.9773 -0.5815
L2 =
1.0e+03 *
2.0502 -3.6327
3.5020 -2.0452
2.1892 -6.7365
6.5770 -1.9141
L3 =
1.0e+04 *
0.5613 -1.0641
1.0371 -0.5483
0.6073 -2.0031
1.9753 -0.5759
L4 =
1.0e+03 *
1.9165 -3.5786
3.4577 -1.8871
2.1515 -6.7123
6.5531 -1.8336