in my cvx problem and when the problem is solved for my variables like E and alpha1, i put these variables in rel_entr and i see the final value is different with alpha1*log2(1+...) as i wrote above. i mean rel_entr value is different from simple form and is less.

x=1.234; % made up number for illustrative purposes
disp([log10(x) -rel_entr(1,x)/log(10)])
0.091315159697223 0.091315159697223

I don’t have the energy to verify everything with your parentheses, so I will just say that you should use the formula alpha(i)*log(1+a/(b*alpha(i))) = -rel_entr(alpha(i),alpha(i)+a/b)
Perhaps that is what you have, other than missing the log conversion factor which you need to fix, depending on what log base you are actually trying to use.

The arguments of rel_entr apparently are not in compliance with the rules stated below. If lo1*tao < 0, you can use inv_pos

Please show us the mathematical expression which you wish to maximize, making clear what the optimization variables are.

help rel_entr

rel_entr Scalar relative entropy.
rel_entr(X,Y) returns an array of the same size as X+Y with the
relative entropy function applied to each element:
{ X.*LOG(X./Y) if X > 0 & Y > 0,
rel_entr(X,Y) = { 0 if X == 0 & Y >= 0,
{ +Inf otherwise.
X and Y must either be the same size, or one must be a scalar. If X and
Y are vectors, then SUM(rel_entr(X,Y)) returns their relative entropy.
If they are PDFs (that is, if X>=0, Y>=0, SUM(X)==1, SUM(Y)==1) then
this is equal to their Kullback-Liebler divergence SUM(KL_DIV(X,Y)).
-SUM(rel_entr(X,1)) returns the entropy of X.

Disciplined convex programming information:
rel_entr(X,Y) is convex in both X and Y, nonmonotonic in X, and
nonincreasing in Y. Thus when used in CVX expressions, X must be
real and affine and Y must be concave. The use of rel_entr(X,Y) in
an objective or constraint will effectively constrain both X and Y
to be nonnegative, hence there is no need to add additional
constraints X >= 0 or Y >= 0 to enforce this.

I have no idea what you are trying to do with a(logical(eye(size(W))))=t1;
I.e. what purpose it serves. I have no idea what a is.

But in any event, in order to be valid CVX syntax (whether or not it makes any sense for your problem), you either need == instead of =. Or don’t declare t a variable, and change it to t1 being the LHS of the =.

Dear expert,
Thanks for your time. I still have this problem.
错误使用 cvx/rel_entr (line 71)
Disciplined convex programming error:
Illegal operation: rel_entr( {real affine}, {complex affine} ).

出错 main (line 98)
maximize (-rel_entr(t2,t2+lo1*tao1)/log(2))

Thank you for helping me answer it, thank you very much!

As I wrote before, the objective function must evaluate to a real scalar.

What if the objective function were allowed to evaluate to a complex number? Which is a bigger (better) objective value, 2 + i or 3 - i? Of course that doesn’t make sense. You need to formulate an optimization problem whose objective function evaluates to a real scalar. If you wish to use CVX, it must be a convex optimization problem following CVX’s rules.

This looks like one CVX problem was infeasible. Therefore, the CVX variable values had value “NaN”. You perhaps then used variable values from this CVX problem as input data into a new CVX problem. CVX then issued an error because NaN values were used in a CVX expression.

Dear expert, Thanks for your time. I want to consult a question.
错误使用 .* (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

出错 * (line 36)
z = feval( oper, x, y );

出错 Untitled (line 122)
real(tao1+tao2)<=real(0.8P1t1trace(V1Fa1));
What’s the problem with this? Can you help me see.