How to modify the error when the window sow me Invalid constraint: {complex affine} >= {real affine}
1 view (last 30 days)
Show older comments
I want to write a code about optimal,so i use cvx in matlab,the picture below is what i want to write

%declare
K=4;
N=4;
nois_var_ak_2pow=[10^-10 10^-10 10^-10 10^-10 ];
nois_var_dk_2pow=[10^-8 10^-8 10^-8 10^-8 ];
bar_r=[10 10 10 10];
P_hat=0.00001;
P_T=10;
h_1=sqrt(1/2)*(randn(N,1)+1i*randn(N,1));
h_2=sqrt(1/2)*(randn(N,1)+1i*randn(N,1));
h_3=sqrt(1/2)*(randn(N,1)+1i*randn(N,1));
h_4=sqrt(1/2)*(randn(N,1)+1i*randn(N,1));
h_kk=cat(2,h_1 ,h_2 ,h_3, h_4)
for n=1:4
h_k{n}=h_kk(1:4 , n);
n=n+1;
end
%===========================================================
cvx_begin
variable FNNK(N,N,K) semidefinite; %c7
variable P ;
Fkk=cat(2,FNNK);
u=0
for o=1:4
Fk{o}=Fkk(1:4,o+3*u:4*o)
u=u+1;
end
%====================================
%object function
minimize( P )
subject to
%====================================
%C6
tr_Fk=0;
for k=1:K
t=trace(Fk{k});
tr_Fk=tr_Fk+t;
end
tr_Fk<=P_T;
%====================================
%c9
total = 0;
for k = 1:K
sumja = 0;
for j = 1:K
if j ~= k
sumja = sumja + h_k{k}' * Fk{j} * h_k{k};
end
end
total = total + sumja+ nois_var_ak_2pow(1);
end
abs(total) >= P
cvx_end
However,after running the code,the window show me some error in this line total >= P
total >= P : Invalid constraint: {complex affine} >= {real affine}
so i modify it as below
abs(total) >= P,but the window show me :Invalid constraint: {convex} >= {real affine}
I don't know how to modify it,can anyone help me?because the constraint does write the total in the code has to be larger than P
0 Comments
Answers (0)
See Also
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!