About "Cannot perform the operation: {real affine} .* {invalid}"

In recently, i find this situation when i run the simulations.

And i don’t what’s the meaning of this.

the code is the following,
i fixed n ,
** W_hat is the (Nt,Nt,K,N) PSD matrix** ,
** lam_hat is the larger than or equal to 0** , and
** h_bar is the (Nt,K,N) complex vector**

X1 = sum(W_hat,3) ;
 cvx_begin quiet
 variables t(K,N_carrier) 
 maximize (sum(log(1+t(:,n))/log(2)))
 subject to 
   for k = 1:K 
   [eye(Nt);h_bar(:,k,n)']*(W_hat(:,:,k,n)-t(k,n).*(X1(:,:,1,n) - W_hat(:,:,k,n)))*([eye(Nt);h_bar(:,k,n)']')+[lam_hat(k,n)*eye(Nt),zeros(Nt,1) ;zeros(1,Nt),-lam_hat(k,n)*(error_radius(k,n)^2)-t(k,n)*noise_power(k,n)] == hermitian_semidefinite(Nt+1);  
    end 
 cvx_end

Can anyone give me a favor?

What this error is indicating is that there are Inf or NaN values in some of the constants involved. When it occurs, check the offending line carefully in your debugger to see if you’re passing in invalid values.

By the way, I recommend using geo_mean(1+t(:,n)) as your objective here. It avoids the successive approximation heuristic that CVX uses for logarithms, but it will produce the same values of t assuming all else is equal.

Here’s another suggestion. Don’t use cvx_begin with the quiet option if you are getting error messages or behaviors you can’t figure out.

Thank you for your suggestions, and i am looking for where has errors.
What’s the meaning of assuming all else is equal?
It means there are not larger than or equal to something any more?
Furthermore, is it cvx_degin sdp is better than original one?

Thank you for your attention.

I just mean as long as you do not change anything else in your model, this alternate objective function will give the same values of t at the optimum.

No, SDP mode is not better. It is just a convenience. What you are doing with hermitian_semidefinite is fine.

OK, Thank you very much.