A problem about CVX


(kloop) #1

clc;
close all;
clear all;
warning off
cvx_setup
K=1;%
M=1;%
N=2;%
delta=1;
sig_r=delta;
sig_d=delta;
P_s=10;
%参数
Cap1=[];
Cap2=[];
Cap3=[];
Cap4=[];
% Cap0=[];
% Cap00=[];
%参数
% PRD=30;
S1_ave=[];
S2_ave=[];
S4_ave=[];
PRD=20;

P_R=(10^(0.1*PRD));
P_r=P_R;
S1_sum=0;
S2_sum=0;
S4_sum=0;
factor=0.6;
iter=10;
%for iter_=1:iter
HSR=(random(‘norm’,0,1,N,K)+(-1)^(0.5)*random(‘norm’,0,1,N,K));
HRD=(random(‘norm’,0,1,K,N)+(-1)^(0.5)*random(‘norm’,0,1,K,N));
HRE=(random(‘norm’,0,1,1,N)+(-1)^(0.5)random(‘norm’,0,1,1,N));
HRG=(random(‘norm’,0,1,1,N)+(-1)^(0.5)random(‘norm’,0,1,1,N));
f0=rands(N
N,1);
ft=f0;
S_1=P_s
kron(conj(HSR)*HSR.’,HRD’*HRD);
S_2=kron(eye(N),HRD’HRD);
S_3=P_s
kron(conj(HSR)*HSR.’,HRE’HRE);
S_4=kron(eye(N),HRE’HRE);
S_5=P_s
kron(conj(HSR)HSR.’,eye(N))+eye(NN);
S_6=P_s
kron(conj(HSR)*HSR.’,HRG’HRG)+kron(eye(N),HRG’HRG);
g=svd(S_5^(-1)S_6);
e1=g(1);
A1=S_1;
A2=S_2;
Ae=S_3;
Ae2=S_4;
B1=S_5;
B2=S_6;
P_R=P_r;
R_1=S_1+S_2;
factor_s=factor
e1;
[Ue,Te,Ve]=svd(Ae);
Vet=Ve(:,1:N
N
K);
R_4=Vet’S_6Vet;
t_ub = 1;
temp_t = svd((S_1+S_2)^(-1)*S_2);
t_lb = temp_t(length(temp_t));
% aa=t_lb;
% bb=t_ub;
step = (t_ub-t_lb)/100;
a1=t_lb;
counter=1;

while a1<t_ub
cvx_begin sdp quiet
variable Q( KNN,NNK ) hermitian;
variable e;
maximize ( real(trace((Vet’R_1Vet)Q))+e );
subject to
(real( trace( Vet’S_2Vet’)Q ) ) +e == 1;
real( trace( (Vet’S_5Vet)Q ) ) <= eP_r;
real( trace( (R_4)Q ) ) >= eQ;
e >= 0;
Q == hermitian_semidefinite(N
N
K);
cvx_end
temp=[temp,cvx_optval];
Q_tmp(:,:,counter)=Q;
a1= t_lb+step*counter;
counter=counter+1;
end
[value, index]=min(temp);
Q_s=Q_tmp(:,:,index);
W = Q_s/e

error in .* (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

error * (line 36)
z = feval( oper, x, y );

error Untitled_1D_1 (line 88)
real( trace( (R_4)Q ) ) >= eQ;

Is anyone willing to help me

SORRY ,This is the first time for me to do that thing。

Layout is very messy


(Mark L. Stone) #2

real( trace( (R_4)*Q ) ) >= e*Q
is a non-convex constraint because e*Q is the product of CVX variables.

For any fixed value of e (i.e., if e is assigned a numerical value in MATLAB, and is not declared as a CVX variable), this is a Linear Programming problem, which will be accepted by CVX.