# How to use CVX solving optimization problem with coordinate desent algorithm?

when I use cvx to solving a easy optimization problem, the correct solution can be obtained. However, using cvx with coordinate desent algorithm, I can’t get a solution.
I have two optimization variables, and after fixing one variable to find the optimal solution, I fix the other variable to find the optimal solution. However, after optimizing once, the following variables will not change, and the optimal solution will not change. The code I wrote in matlab is roughly as follows:

``````        ed = 1e-3;
eh = 20;
pe = 6;
M = 25;
N = 20;
iterations = 100;
HbPre = rand(M, N, "like",1i);
HbMeasured = rand(M, N, "like",1i);
Hd = rand(M, N, "like",1i);
pdB = rand(M, 1, "like",1i);
for i = 1:iterations
cvx_begin quiet
variable wCur(N) complex
minimize(norm(HbPre * wCur - pdB))
subject to
norm(Hd * wCur) <= sqrt(ed);
norm(wCur) <= sqrt(eh);
cvx_end
cvx_begin quiet
variable HbCur(M, N) complex
minimize(norm(HbCur * wCur - pdB))
subject to
norm(reshape(HbCur - HbMeasured, M * N, 1)) <= pe;
cvx_end
HbPre = HbCur;
end
``````

That is, no matter how many iterations, HbCur will never change, so am I writing the coordinate descent algorithm wrong?

Remove `quiet` and look at the CVX and solver output so you will see better what is going on.

Even if you implemented it 'correctly", which I haven’t really checked, see