# How to set the LMI correctly

Hello everyone, I can 't solve the problem, LMI 3X3 does not want to work and gives errors, but 2X2 works
3Х3
clc

cvx_begin sdp

variable Y(2, 2, N) symmetric
variable Z(1,2, N-1)
variable gamma_squared

minimize(gamma_squared)

for k = 1: N - 1

``````Y(:, :, 1) >= R;

[        Y(:,:,k)                     (A*Y(:,:,k) + B_u*Z(1,:,k))'      0
A*Y(:,:,k) + B_u*Z(1,:,k)                    Y(:,:,k+1)               B_v
0                                      B_v'                    I     ] >= 0;

[          Y(:,:,k)                     (C_1*Y(:,:,k)+D(1)*Z(1,:, k))'   0
C_1*Y(:,:,k)+D(1)*Z(1,:,k)                     gamma_squared*I                0
0                                         0                       0] >= 0;

[         Y(:,:,k+0)                    (C_1*Y(:,:,k+0)+D(1)*Z(1,:, k+0))' 0
C_1*Y(:,:,k+0)+D(1)*Z(1,:,k+0)                     gamma_squared*I              0
0                                       0                    0  ] >= 0;
``````

end

cvx_end

for i=1: N-1
teta_nc(:,i) = Z(1,:,i) * inv(Y(:,:,i));
A_t_nc(:,:,i) = A + B_v * teta_nc(:,i)’;
end
Error using cvx/cat (line 40)
All dimensions but the one being concatenated (2) must be equal.

Error in cvx/horzcat (line 2)
y = cat( 2, varargin{:} );

Error in teta_no_control (line 15)
[ Y(:,:,k) (AY(:,:,k) + B_uZ(1,:,k))’ 0

2Х2
clc

cvx_begin sdp

variable Y(2, 2, N) symmetric
variable Z(1,2, N-1)
variable gamma_squared

minimize(gamma_squared)

for k = 1: N - 1

``````Y(:, :, 1) == R;

Y(:,:,k+1) - Y(:,:,k) - h*(A*Y(:,:,k) + Y(:,:,k)*A' + B_u*Z(1,:,k) + Z(1,:,k)'*B_u' + B_v*B_v') == 0;

[          Y(:,:,k)                     (C_1*Y(:,:,k)+D(1)*Z(1,:, k))'
C_1*Y(:,:,k)+D(1)*Z(1,:,k)           alph(1)^2*gamma_squared*I       ] >= 0;
``````

end

cvx_end

for i=1: N-1
teta_nc(:,i) = Z(1,:,i) * inv(Y(:,:,i));
A_t_nc(:,:,i) = A + B_v * teta_nc(:,i)’;
end
Status: Solved
Optimal value (cvx_optval): +4

clc
clear

beta = -0.1;

A = [0 1
-1 beta];

B_u = [0 1]’;

B_v = [0 1]’;

C_1 = [1 0];
C_2 = [-1 -beta];

D = [0 1];

T_0 = 20;

N = 20;

h = T_0 / N;

I = 1;

R = eye(2);

alph(1) = 0.5;
alph(2) = 1 - alph(1);

Obviously, the elements of the matrix you are constructing are not conformal. And the LMIs end up not being 3 by 3, but something larger (5 by 5?), because it is 3 by 3 block dimensions.

You haven’t provided a clean reproducible problem, so I don’t know exactly what the fix needs to be. But I believe the lower left 0 in the 3 by 3 matrices should be `zeros(1,2)`; and the upper right 0 in the first matrix should be `zeros(2,1)` so as to be conformal with `B_v` below it, but I don’t know what the dimensions of I are (I guess it needs to a scalar). Anyhow, this should give you an idea of what you need to fix… I leave you to find all the elements which need to be fixed.

Perhaps you extracted this from a paper in which 0 was used to denote a vector of the correct dimension., not necessarily the scalar 0?