My codes are

variable B(n)

expression y(n-1)

for i = 1:(n-1)

X = (B(i)*B(n)+a)/(B(n)+b)

y(i) = entr(X)

end

maximize (sum(y))

it reminds me:

Invalid quadratic forms: not a square. How can I express the above objective function? Thanks!

My codes are

variable B(n)

expression y(n-1)

for i = 1:(n-1)

X = (B(i)*B(n)+a)/(B(n)+b)

y(i) = entr(X)

end

maximize (sum(y))

it reminds me:

Invalid quadratic forms: not a square. How can I express the above objective function? Thanks!

This looks non-convex to me. You will need to use a non-convex optimizer.

Thank you for the reply. For CVX, can I declare two variables, one vector variable and one scalar variable? Thanks.

Yes, but that won;t let you get around a problem being non-convex.

Thank you. Indeed. I will optimize that problem by other techniques like genetic algorithm. Anyway, thank you.