To avoid the coupling of two auxiliary variables (z(k) and relax_scaler_j(k)) by multiplying them, I introduce a temporary variable aux_var(K) to substitute into the matrix. Is this correct?
Part of the code is as follows:
variable relax_scaler_j(K)
variable z(K)
expressions LMI_S(N_t*(L+1)+1,N_t*(L+1)+1,N,K) aux_var(K)
for k=1:K
LMI_S(:,:,n,k)=[A+relax_scaler_ww(k)*eye(N_t*(L+1)) B;...
B' real(C)-aux_var(K)-relax_scaler_ww(k)*H_error(:,:,max_m,n,k)^2];
end
maximize sum(B_w*relax_scaler_I)-scaler_xx(kk)*sum(E_UAV(1,:)+D)
subject to
for k=1:K
aux_var(k)=quad_over_lin(z(k), relax_scaler_j(k));
LMI_S(:,:,n,k)==hermitian_semidefinite(N_t*(L+1)+1);
end
CVX expressions are initialized (by default) to all zeros. So aux_var(k) in LMI_S is the constant 0 . Therefore, that is what is in the semidefinite constraint. The setting of aux_var within the for loop has no effect on LMI. So the semidefinite constraint will be allowed by CVX. But it will not be what you want.
In order to get your desired aux_var into the semdefinite constraint, you need to move aux_var(k)=quad_over_lin(z(k), relax_scaler_j(k)); to before LMI_S(:,:,n,k)=[A+relax_scaler_ww(k)*eye(N_t*(L+1)) B;... B' real(C)-aux_var(K)-relax_scaler_ww(k)*H_error(:,:,max_m,n,k)^2];
However, CVX will reject that because semidefinite constraints must be affine, which aux_var is not (it is convex). So this appears to be a Nonlinear Matrix Inequality, not a Linear Matrix Inequality, and therefore non-convex.
I am not ruling out that there is a reformulation as LMI, but if so, I leave that to you.
In general, use of expressions is not a majic “get out of non-convexity jail free” card, as you seem to try to be doing.