Invalid quadratic : not a square

Hi, everyone.I have problem to solve the following question.

clc
clear all

I = 50;
eps1 = 10^-6;
eps2 = 10^-6;
fmax = 20 * 10^9;
s = normrnd(1000, 100, I) * 8000 ;

cvx_begin
variable a(I) nonnegative
variable fs(I) nonnegative
variable b(I) nonnegative
%variable m(I)

maximize sum(a)
subject to
0 <= a <= 1;
beta = inv_pos(b+eps1);
%abs(a) .* beta;
expression mu(I)
mu = diag(a * beta.');

cvx_end

Error using cvx_throw (line 22)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

Error in bsxfun (line 11)

Error in * (line 42)

Error in sim (line 25)
mu = diag(a * beta.’);

I need help

CVX doesn’t allow dividing CVX variables (except in gp mode). And inv_pos is not a way around that rule. In this case, specifically you are multiplying a CVX variable by a convex expression ( inv_pos(....) ), which is not allowed.

I don’t know how, if at all, CVX can be used for your problem, because I don’t know what you want to do with mu.

Your first task is to determine whether your optimization problem is convex.

If you do have a convex optimization problem which can be formulated in CVX, things might not go well numerically unless you get the input numbers much closer to 1 in magnitude (by rescaling).

The portion of the program you show doesn’t have integer or binary variable declarations, so I removed the categorization of MIDCP.