Is there anyone to solve the error of convex file?
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.
% 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 l = 0
%initial controller for each vertices
Aci=diag([0.2 0.5 -.3]) ;Bci=[1;0;-1] ;Cci=[0 0 1]; Dci=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;
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;
else %i=4 forth
Aci = diag([0.4 0.8 -0.2]); Bci=[0;1;1]; Cci=[0 1 0] ;Dci=1;
Cci = CCRi
Dci = DCRi
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) else end end end 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; cvx_end 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 ACRl=Aci BCRl= Bci CCRl=Cci DCRil= Dci cvx_end pause %step 4 if mu(l-1)-mu(l)>0 l=l+1 else Kl=ss(ACRl,BCRl,CCRl,DCRl,0.1) break end end
% 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])
% 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.
How are you?
I solved the problem of modeling uncertainty but I have another problem .
can you help me?