cvx_begin quiet % sdp gp
variable phi(1,L) complex
variable t
minimize t
for k=1:size(X,1)
x_k(k,:)=X(k,:).*phi;
end
for m=1:Mt
for i=1:n
PF(i)=trace(a(:,i)*a(:,i)'*x_k(m,:)'*x_k(m,:));
end
PS=PS+PF;
end
for i=1:n
delta_psd(i)=PS(i)-psd(i);
end
sum_dpsd=sum(delta_psd(:));
sum_dpsd<=t;
cvx_end

Disciplined convex programming error:
Invalid quadratic form: must be a scalar.

Thanks a lot.
New message is “wrong using cvx/square_pos, too many varibles。”
when use
PF(i)=square_pos(norm((x_k(m,:)*a(:,i)),‘fro’))
I don’t know what does 2 mean

I was able to help you reformulate to comply with CVX’s rules. But it’s your optimization problem and input data. So you should figure out what to do about it if you don’t like the solution.

alf=0.01;
cvx_solver mosek
cvx_begin quiet % sdp gp
variable phi(1,L) complex
variable r
expression x_k(Mt,L)
expression PS(1,n)
expression PF(1,n)
expression X2
variable t
minimize t

for k=1:size(X,1)
X1(k,:)=X(k,:).*phi;
end
for m=1:Mt
for i=1:n
% PF(i)=a(:,i)’*a(:,i)*x_k(m,x_k(m,:)’-rPsd_d(i);
% PF(i)=abs(a(:,i)*a(:,i)’*x_k(m,:)'x_k(m,:))-rPsd_d(i);
PF(i)=square_pos(norm((X1(m,a(:,i)),‘fro’))-rPsd_d(i);
end
PS=PS+PF;
end
%
for i=1:n
delta_psd(i)=PS(i)-Psd_d(i);
end
sum(delta_psd(:))<=t;

for m=1:Mt
X2(m)=X1(m, : ) R1( X1(m,:))’;
end

sum(X2)<=t;
cvx_end

R1 is a Hermitian Matrix.
the message is
Disciplined convex programming error:
Invalid quadratic form: product is complex.
X2(m)=X1(m, : )* R1*( X1(m,:))’;