# Warning: Matrix is close to singular or badly scaled. Results may be inaccurate

Sometimes, i run the following codes, this situation happens.

i have no idea to handle this problem,

Here, x and y are the (K,Nt) matrix, each component belongs to (0,1),

code is in the following,

power_allocation = 0 ;

``````cvx_begin quiet
variables W(Nt,Nt,K,N_carrier) w(Nt,K,N_carrier)
variables lambda(K,N_carrier) t(K,N_carrier)

W_sum = sum(W,3) ;
for i =1:K
power_allocation = power_allocation + w(:,i,n)'*w(:,i,n) ;
end

maximize (sum(t(:,n)))
subject to
for k=1:K
[eye(Nt); h_bar(:,k,n)']*(-(abs(x_feasible_point(k,n) )^2 )*W_sum(:,:,1,n) )*([eye(Nt)     ; h_bar(:,k,n)']') + [(lambda(k,n)*eye(Nt)),(x_feasible_point(k,n)')*w(:,k,n);x_feasible_point(k,n)*(w(:,k,n)'),(-lambda(k,n)*(error_radius(k,n)^2)-1-y_bar_old(k,n)*(t(k,n)-1)+entr(y_bar_old(k,n))-(abs(x_feasible_point(k,n))^2)*noise_power(k,n)+ 2*real((h_bar(:,k,n)'*w(:,k,n) )*(x_feasible_point(k,n)') ) )] == hermitian_semidefinite(Nt+1) ;

[1,w(:,k,n)';w(:,k,n),W(:,:,k,n)] == hermitian_semidefinite(Nt+1) ;
lambda(k,n) >=0 ;
end

power_max/N_carrier - power_allocation >= 0 ;

cvx_end
``````

Can anyone give me a favor?

What I mean is: look at your constants `h_bar`, `x_feasible_point`,`noise_power`, etc. If there is a very wide difference between the minimum and maximum values, you’re likely to have a problem. Numerical solvers can’t handle large dynamic range in coefficients.