Question about convex optimization

Hi ,
Is there anyone to solve the error of convex file?
thank you…

You need to provide a much clearer description of your error. I have ni idea what you are talking about,

Perhaps English is not your native language, but if you show a program and the error message, maybe we can provide some help.

I wanted to send the convex file but I can’t.
could you give your’s email address that i send it for you.?
the error is :
Error using * (line 80)
Invalid operand. Variables of type “cvx” cannot be combined with other models.

Error in karimi (line 78)
[(Q-A’QA) (QA+MT-XA)’ (B’*MT-B’XA)’ C’;

You can post your code on this forum. We don’t use emails here.

It might help if you show us the output of whos (executed just prior to where the error occurs) , so we will know what things are.

close all
clear all
% parameters contain uncertainty up to 20%
r1 = ureal(‘r1’,-0.1,‘percent’,20)
r2 = ureal(‘r2’,0.5,‘percent’,20)
r3 = ureal(‘r3’,-1.2,‘percent’,20)
r4 = ureal(‘r4’,0.2,‘percent’,20)
% open loop system
Ag =[0 0 -r1;1 0 -r2;0 1 -r3]
Bg = [r4;1;0]; Bw=zeros(3,1)
Cg=[0 0 1]
Cz=[0 0 1]
OP = ss(Ag,[Bg Bw],[Cz;Cg],[Dzu Dzw;0 Dw],0.1)
%% step procedure
% ST =epsilion > 0; % small tolerance
% step 1
for i=1:4
for l = 0
if l==0
%initial controller for each vertices
%i=1 first
if i==1
Aci=diag([0.2 0.5 -.3]) ;Bci=[1;0;-1] ;Cci=[0 0 1]; Dci=1;
Ki= ss(Aci,Bci,Cci,Dci,0.1);
else if i==2 %i=2 second
Aci=diag([0.1 -0.2 0.25]) ; Bci=[0;0;1] ;Cci=[0 0 -1] ;Dci=-1;
Ki= ss(Aci,Bci,Cci,Dci,0.1);
else if i==3 %i=3 third
Aci =diag([0.2 0.6 -0.5]) ; Bci=[1;0;0]; Cci=[1 0 0] ;Dci=1;
Ki= ss(Aci,Bci,Cci,Dci,0.1);
else %i=4 forth
Aci = diag([0.4 0.8 -0.2]); Bci=[0;1;1]; Cci=[0 1 0] ;Dci=1;
Ki= ss(Aci,Bci,Cci,Dci,0.1);
Bci= BCRi
Cci = CCRi
Dci = DCRi
if i==1
Agi = [0 0 -r1;0 0 0;0 0 0]
Bgi = zeros(3,1)

    else if i==2
            Agi = [0 0 0;0 0 -r2;0 0 0]
            Bgi = zeros(3,1)
        else if i==3
                Agi =[0 0 0;0 0 0;0 0 -r3]
                Bgi = zeros(3,1)
    Agi = [0 0 0;1 0 0;0 1 0]
    Bgi = [-r4;1;0]
    % step 2
    A =[Agi+Bgi*Dci*Cg Bgi*Cci;Bci*Cg Aci];
    B=[Bw+Bgi*Dci*Dw;Bci*Dw]; C=[Cz+Dzu*Dci*Cg Dzu*Cci] ; D=Dzw+Dzu*Dci*Dw;
    n = size(A,1);
    cvx_begin sdp
    variable X(n,n)  symmetric;
    variable Q(n,n) ;
    variable MT(n,n) ;
    variable mu
                minimize mu
                subject to
    [(Q-A'*Q*A) (Q*A+MT-X*A)' (B'*MT-B'*X*A)' C';
        (Q*A+MT-X*A) 2*X-Q (B'*X)' zeros(n,1);
        (B'*MT-B'*X*A) B'*X eye(n,1) D';
        C zeros(1,n) D mu*eye(1,1)]<0;
    T = inv(chol(X));
    M = T'*MT*T;
    P =T'*Q*T;
    % step 3
    m = size(Agi,1);
    cvx_begin sdp
    variable Aci(m,m)  symmetric;
    variable Bci(m,1)  symmetric;
    variable Cci(1,m)  symmetric;
    variable Dci(1,1)  symmetric;
    variable mu
    minimize mu
    subject to
    [P-M'*P*M (P*M-M+inv(T)*A*T)' (zeros(1,2))' (C*T)';
        P*M-M+inv(T)*A*T 2*eye(n,n)-P inv(T)*B zeros(1,2)';
        zeros(1,2) (inv(T)*B)' eye(n,1) D';
        C*T zeros(1,2) D mu*eye(1,1)]<0
    BCRl= Bci
    DCRil= Dci
    %step 4
    if mu(l-1)-mu(l)>0


% S1=[ACR1+jeye(3,3) BCR1;CCR1 DCR1];
% S2=[ACR2+jeye(3,3) BCR2;CCR2 DCR2];
% S3=[ACR3+jeye(3,3) BCR3;CCR3 DCR3];
% S4=[ACR4+jeye(3,3) BCR4;CCR4 DCR4];
% S = psys([S1,S2,S3,S4])
% pause
% Alanda =[Ag+BgDcCg BgCc;BcCg Ac];
% Blanda=[Bw+BgDcDw;BcDw]; C=[Cz+DzuDcCg DzuCc] ; D=Dzw+DzuDcDw;
% CL = ss(Alanda,Blanda,C,D,0.1);
% eigen(Alanda) % matrix A is called robustly stable if the magnitude of all its eigen va;ue is less then one for all landa…

I send for you the code of program.

This is the paper that I should simulate it with convex.

You did not show the results of whos , as I requested. However, I suspect the error you are receiving is a result of using ureal (Create uncertain real parameter in robust control toolbox) The ureal items go into Agi and Bgi which go into A and B which are in the “LMI” in which you get the error message. As a result, A and B must be something other than (single or) double precision matrices, and therefore incompatible with CVX expressions.

I dob’t know what you are trying to do with ureal items, but you will have to find a different way to model your problem which does not involve using them in CVX expressions such as constraints.

ureal is for modeling uncertainty.

But how can i model this convex problem. This approach is supposed in the article and I couldn’t find another way to model it.

Do you see the pictures of article that i send it for you.?
this is the way that i should model the problem.

I don’t know how uncertainty enters into your problem, but you can’t use ureal from the Robust Control Toolbox in combination with CVX. How to incorporate uncertainty into your optimization problem is a modeling matter outside the scope of this forum.

so , I should understand that how can i model uncertainty in the problem. Is it correct?

It is your problem. You need to figure out how to model and incorporate whatever uncertainty you think needs to be accounted for,

Thank you for your answer.

Hi ,
How are you?
I solved the problem of modeling uncertainty but I have another problem .
can you help me?