Hello guys,

I’m writing a code for convex optimization problem with CVX (matlab)

and I faced DCP errors

how can I solve it?

K = 5;

h = randn(K,1);

h = sort(abs(h));

disp(h)

sigma2 = 0.1; % 잡음 sigma^2

P = 10; % 제약 조건 상수 P

cvx_begin

variable a nonnegative;

variable b(K,1) nonnegative;

```
% MSE 정의
MSE_1 = cvx(zeros(K,1));
for i = 1:K
MSE_1 = a * h(i) * b(i) - 1; % sum of squares
end
MSE = sum_square(MSE_1) + sigma2 * square(a);
minimize(MSE)
|b_k|^2 <= P for all k
subject to
b.^2 <= P;
```

cvx_end

the error is

Disciplined convex programming error:

Invalid quadratic form(s): not a square.

오류 발생: * (36번 라인)

z = feval( oper, x, y );

오류 발생: OAC_CVX (17번 라인)

MSE_1 = a * h(i) * b(i) - 1; % sum of squares

and original problem is