```
cvx_begin
variable w_0( dim ) complex;
variable lambda_0;
maximize( sub_chan_band * (6.8 * sqrt( lambda_0 ) - 4.1 ) * 10^5 );
subject to
lambda_0 >= 0;
H_0 == hermitian_semidefinite( dim );
beta_0^2 * quad_form( w_0, H_0 ) == noise_power * lambda_0;
for j = 1:dim
I_j( j, j ) = 1;
w_0' * I_j * w_0 <= 1/dim;
end
cvx_end
```

I added the 2nd constraint to let CVX know that H_0 is psd.

I am getting this error:

Disciplined convex programming error:

Invalid constraint: {convex} == {real affine}

Can someone help me out please?

The error is due to the constraint

` beta_0^2 * quad_form( w_0, H_0 ) == noise_power * lambda_0;`

which is a nonlinear (quadratic) equality constraint, which is non-convex, and is disallowed by CVX.

It appears from your description that `H_0`

is semidefinite input data. In that case, do not include the `H_0 == hermitian_semidefinite( dim );`

statement.

Presuming that is the case, `quad_form( w_0, H_0 )`

is a convex quadratic, and can be used appropriately within CVX. But using it in an equality constraint makes the constraint non-convex. However, if the constraint were relaxed to `<=`

, i.e.,

`beta_0^2 * quad_form( w_0, H_0 ) <= noise_power * lambda_0`

, that would be convex, and would be accepted by CVX unless there were numerical issues associated with `H_0`

, which might have to be cleaned up. You will have to determine if this relaxation is appropriate or acceptable for your purposes.

Given that you have been using CVX for quite some years based on your posting history, now would be a good time to re-read the CVX Usersâ€™ Guide, which should make your mistakes readily apparent.