# My variable all come out zero

I want to optimize S0 and S1 for given D0 and D1. Objective function is minimize MSE. But the result of S0,S1,Mse are nearly 0. Here is my code, please help me out.

``````%%%%%%%%%%%%%%%%%%
Nt = 3;
Nr = 3;
Ngr = 3;

delta = [0.06 0.02 0.06 0.20];
idel = 1;
%variance of noise  dB
delta_ndB = 0;
%transmit power, interference power dB
Ps = 10;
r = 5;
%MSE gate
msee = zeros(10,1);
SS0 = [];
SS1 = [];
DD0 = [];
DD1 = [];

p0 = 0.5;   pd = 0.9;   pf = 0.2;
p00 = p0*(1-pf);
p01 = p0*pf;
p10 = (1-p0)*(1-pd);
p11 = (1-p0)*pd;

LOOP = 1;
tic;

while LOOP <= 1

%%%perfect channel state inforamtion H for SR, G for PR
H = sqrt(1/2)*(normrnd(0,1,Nr,Nt)+1i*normrnd(0,1,Nr,Nt));
G = sqrt(1/2)*(normrnd(0,1,Ngr,Nt)+1i*normrnd(0,1,Ngr,Nt));

%while idel <=1 %denot the degree of the uncertainty of channel.

%%%channel error
Delta_H1 = (-1+2.*rand(Nr,Nt))+1i*(-1+2.*rand(Nr,Nt)); %%create the error random
norm_F1 = sqrt(sum(diag(Delta_H1'*Delta_H1)));
deltaH = Delta_H1*(delta(idel)/norm_F1); %% normalize and scale its degree

%imperfect channel
barH = H - deltaH;
barG = G - deltaG;

idel = 1; % try to calculate the case when delta = 0.06;

D0 = 0.001*eye(Nt,Nr);
D1 = 0.001*eye(Nt,Nr);
Max_round = 5;
round = 1;

while round <=Max_round

cvx_begin sdp quiet
variable S1(Nt,Nt) hermitian;
variable S0(Nt,Nt) hermitian;
variable Tau;
variable lamda;
variable betaa;
expression F0(Nt*Ngr,Nt*Ngr);
expression F1(Nt*Ngr,Nt*Ngr);
expression F2(Nt*Nt,Nt*Nt);
expression F3(Nt*Nt,Nt*Nt);
expression R0(Nt*Nt,Nt*Nr);
expression R1(Nt*Nt,Nt*Nr);
expression V0(Nt*Nt,1);
expression V1(Nt*Nt,1);
minimize Tau;
subject to
S1 == hermitian_semidefinite(Nt);
S0 == hermitian_semidefinite(Nt);
Tau >= 0;
lamda >= 0;
betaa >= 0;
real((p00+p10)*trace(S0)+(p01+p11)*trace(S1)) <= 10^(0.1*Ps);
F0 = (1-pd)*kron(S0.',eye(Ngr));
F1 = pd*kron(S1.',eye(Ngr));
[lamda*eye(Nt*Ngr)-(F0 + F1), -(F0+F1)*vec(barG);-(vec(barG))'*(F0+F1),real(10^(0.1*r)-lamda*(delta(idel))^2-(vec(barG)'*(F0+F1)*vec(barG)))] >= 0;
F3 = kron(S0.',eye(Nt));
F4 = kron(S1.',eye(Nt));
R0 = kron(eye(Nt),D0)
R1 = kron(eye(Nt),D1);
V0 = vec(D0*barH)-vec(eye(Nt));
V1 = vec(D1*barH)-vec(eye(Nt));
[betaa*eye(Nt*Nr)-(p00+p10)*(R0'*F3*R0)-(p01+p11)*R1'*F4*R1,-(p00+p10)*R0'*F3*V0-(p01+p11)*R1'*F4*V1;-(p00+p10)*V0'*F3*R0-(p01+p11)*V1'*F4'*R1,real(Tau-(p00+p10)*(V0'*F3*V0+(10^(0.1*delta_ndB))*vec(D0)'*vec(D0))-(p01+p11)*(V1'*F4*V1+(10^(0.1*delta_ndB))*vec(D1)'*vec(D1))-betaa*(delta(idel)^2))] >= 0;
cvx_end``````

Let me offer this suggestion if you are having trouble understanding how CVX and the solver it invokes are arriving at whatever solution. Invoke cvx_begin without the quiet option. You should want to see as much output as possible from the solver, not the least.