Disciplined convex programming error: Only scalar quadratic forms can be specified in CVX

I wrote this code, it did not work, because of > Disciplined convex programming
error: Only scalar quadratic forms can be specified in CVX> . why I got this and how can I solve it?
variable x(n,1)

You haven’t told us what a1 and a2 are. I will presume they are non-negative constants and ignore them for the time being. Your objective as written is not a scalar, so it can not be a valid objective function. It’s also not clear to me how many times you want the components of x to be in effect squared. As written, you are getting something like x^4. Bottom line: I don’t know what problem you are trying to solve.

Is this what you want?

If x is intended to be complex, you need to declare it as such

variable x(n,1) complex

a1 is a vector with size n1
a2 is a vector with size 1
n. and all variables are complex.

I don’t know whether this is what you want. Note that .’ is non-conjugate transpose.

variable x(n,1) complex

Or I believe you could use instead

so .’ means non-conjugate transpose and ’ means conjugate transpose?

Yes. Look at help transpose, help ctranspose, and help cvx/transpose and help cvx/ctranspose…

Some of my * got lost (now fixed). Anyhow, I made it more complicated than necessary, because conj can be used

I have a problem in optimization, I could not solve it for 8 month. can you help me?

If it is a CVX question, you can ask. Otherwise, another venue would be more appropriate,.