Cannot perform the operation: {real affine} ./ {invalid}

I am a newcomer, during the programming process I had a few problems, for the first for loop it can only loop once, and has the following error.

错误使用 .*
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {invalid}

出错 ./ (第 19 行)
z = times( x, y, ‘./’ );

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

出错 / (第 15 行)
z = mtimes( x, y, ‘rdivide’ );

出错 UAV1_optimization (第 79 行)
rate1 = p(ii)*u1(ii)/(log2(u(ii,iter)^2+p(ii)*u(ii,iter)));

invalid is probably due to an input having value NaN. Sometimes this occurs due to using CVX in a loop (e.g., SCA) in which the optimal variable value from one CVX problem is used as or transformed into input data for the next CVX problem; but the first CVX problem was not solved successfully (infeasible, unbounded, or solver numerical difficulty), which causes CVX to populate variable values with NaN.

The first loop error is not because the constraint part is not sufficient

Does this happen on the first CVX problem you are solving? If so, look at the value of all the input data in the line of code which triggers the error message. I think at least one item will be NaN.You need to make all input be numbers. NaN is not allowed by CVX. What is the minimum of x^2 + NaN*x? That doesn’t make any more sense to CVX than it does to you.

If the first CVX problem is accepted, but does not find optimum, and hence produces NaN for optimal variable values, you need to “debug” why the problem did not successfully solve. The first thing is to look (and post) the solver and CVX output.