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.
出错 (第 82 行)
PF(i)=trace(a(:,i)*a(:,i)’*x_k(m,:)’*x_k(m,:));
for m=1:Mt
for i=1:n
PF(i)=a(:,i)'*a(:,i)*x_k(m,:)*x_k(m,:)';
% PF(i)=trace(a(:,i)*a(:,i)'*x_k(m,:)'*x_k(m,:));
end
PS=PS+PF;
end
change the line 82 another mistake
Unable to perform assignment because value of type ‘cvx’ is not convertible to ‘double’.
Use expression holders http://cvxr.com/cvx/doc/basics.html#assignment-and-expression-holders
Rearrange per cyclic permutation invariance of trace
PF(i) = square_pos(norm(x_k(m,:)*a(:,i)),'fro'))
Edit: removed extraneous ,2 which was a typo.
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
Sorry. I just edited my previous post to correct the typo.
Thank you.
A new problem is the optimal result of variable ‘phi’ is 0
How to avoid this station?
(upload://anXTdzWxGbGqa3ekK0cwcFvhQ6l.png)
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.
Hi, Mark, I’m sorry to trouble you again.
f=linspace(0,1,n);
a=exp(-1i2pi*(0:L-1)’*f);
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,:))’;
The problem was solved
for m=1:Mt
X2(m)=quad_form(X1(m,:).’,R1);
end