How can I solve this optimization problem using MATLAB CVX?

524 views Asked by At

enter image description here

I used the following code to solve this problem

%System parameters:
N = 2;
K = 8;
M = 4;
C_l=4;
H = [0.1185 0.2811; 0.3550 0.8224; 0.3260 0.9644; 0.5333 0.6083; 0.6871 0.2298; 0.2594 0.8361; 0.1309 0.2454; 0.4715 0.2111]; %(K,N) matrix
A = [-1 1; 1 0]; %(N,N) integer matrix
C = [0 -1 1 1; 0 -1 1 1; 0 1 -1 0; 0 1 -1 0; -1 0 1 -1; -1 0 1 -1; 1 0 0 -1; 1 0 0 -1]; %(N,M) integer matrix
P = 125*eye(M); %(M,M) diagonal matrix
P_u = 125*eye(K); %(K,K) diagonal matrix
S1 = [0.5623    0.5610    0.8769    0.6921    0.8645    0.8924    0.8373    0.8927]; %(1,K) vector
% I want to find matrix B with dimensions N*M that minimizes the difference
% between S2 and S1 vectors.
cvx_begin
  variable B(N,M)
    %calculate S2 from B and the other given inputs
        for j=N:-1:1
            d(j) = (B(j,:)*P*B(j,:)')/((2^(2*C_l))-(norm(A(j,:))^2));
        end
        D = diag(d);        
        for i=K:-1:1   
            V(i)=C(i,:)*P*B'*H(i,:)'*inv(1+H(i,:)*(A'*D*A+B*P*B')*H(i,:)');
            sigma(i)=norm((V(i)*H(i,:)*B-C(i,:))*(P^(1/2)))^2+(V(i)^2)*(1+H(i,:)*A'*D*A*H(i,:)');           
            S2(i)=0.5*(log2((P_u(i,i))/(sigma(:,i))));
        end
  minimize(sum(S2-S1).^2)
  subject to
  for k=1:1:K
      S2(k) >= S1(k);
  end
cvx_end

I received the following error:

Error using  *  (line 126)
Disciplined convex programming error:
    Only scalar quadratic forms can be specified in CVX
.

Error in doOptimization3 (line 24)
            V(i)=C(i,:)*P*B'*H(i,:)'*inv(1+H(i,:)*(A'*D*A+B*P*B')*H(i,:)');

Can anyone help me to modify my code to solve this problem as I am a beginner in using cvx?

0

There are 0 answers