# Can anyone help me to fix this error

In the First 4 iteration Cvx status is “solved” but after 4 iteration status is Failed. i already used Mosek …
function [W,tau,mu] = calW(barHbsue, Pbs, G, Phi, A, d, e, M, K, epsilon, W_t, B, D, E, tau_u, mu_u)
% Calculate intermediate matrices
S = Phi’APhi
G;
T = PhiG;
% Adjust the input scale of CVX to ensure its performance
barHbsue = barHbsue * 1e4;
d=d
1e8;
S=S1e3;
T=T
1e3;
e=e*1e6;
% Initialize variables
mu = ones(K, 1);
% Start CVX optimization
cvx_clear;
cvx_begin
variable W(M, M + K) complex
variable tau nonnegative
variable mu(K, 1) nonnegative
maximize(tau)
subject to

``````        % Constraint loop for each user j
for j = 1:K
denom = 0;
for k = 1:1:K
if k ~= j
denom = denom + real(barHbsue(:, j)' * (W * W_t' - W_t(:, k) * W_t(:, k)') * barHbsue(:, j));
end
end
denom=denom + d(j);
mu(j) >= denom ;
end

% Quadratic constraints for each user j
for j = 1:K
tau_u * square_pos(mu(j)) / (2 * mu_u(j)) + mu_u(j) * square_pos(tau) / (2 * tau_u) <= square_pos(norm(barHbsue(:, j)' * W_t(:, j)))
end

% General constraints
tau >= epsilon;

square_pos(norm(W, 'fro')) <= Pbs;
square_pos(norm(S * W, 'fro')) + square_pos(norm(T * W, 'fro')) <= e;
(1+1/epsilon)*real(barHbsue(:,1)'*(W_t(:,1)*W_t(:,1)')*barHbsue(:,1))-real(barHbsue(:,1)'*(W_t*W_t')*barHbsue(:,1)+d(1))>=0;
(1+1/epsilon)*real(barHbsue(:,2)'*(W_t(:,2)*W_t(:,2)')*barHbsue(:,2))-real((barHbsue(:,2)'*(W_t*W_t')*barHbsue(:,2))+d(2))>=0

cvx_end
``````

## Error details: number of iterations = 70 Total CPU time (secs) = 0.42 CPU time per iteration = 0.01 termination code = 3 DIMACS: 7.3e-08 0.0e+00 2.5e-08 0.0e+00 -2.3e-01 6.3e-02

Status: Failed
Optimal value (cvx_optval): NaN

You haven’t shown the code for how the multiple iterations of CVX are performed. But let me guess it is some sort of SCA, alternating variables, or similar. You should check the input data being used in the iteration which fails, perhaps there are some “wild” large magnitude numbers which are beyond the solver’s capability to handle.

Papers make a lot of claims about their algorithms converging. Those claims are not always bome out in practice.