# Error! Disciplined convex programming error: Invalid quadratic form(s): not a square

The problem is given as follows Since the problem is convex with respect to power \ro_i and p_i .
I solve the problem for n = 1.
I use the cvx toolbox for solving it.
The code is given as follows:

clc
clear all
close all
xs = 0; ys = 50;
xe = 100; ye = -50;
x_source = 0; y_source = 0;
xy(1,1) = 2;
xy(2,1) = 48;
x_destination = 100; y_destination = 0;
H = 20;
V = 4;
a = 3;
B = 0;
delta = 2e-13;
gama = 10^(10/10);
gama0 = 10^(80/10);
N = 50;
Ps = 10;
step_beta = .001;
n_x = 1;
d_sr(n_x) = sqrt((xy(1,n_x)-x_source)^2 + (xy(2,n_x)-y_source)^2 + H^2);
d_rd(n_x) = sqrt((x_destination - xy(1,n_x))^2 + (y_destination - xy(1,n_x))^2 + H^2);
d_sd(n_x) = sqrt((x_destination - x_source)^2 + (y_destination - y_source)^2 );
cvx_begin
% cvx_solver sedumi
variables x y
% minimize ( -.5* log10(1 + Psgama +…
% (Ps * gama0.^2 * y * x /((x+a)
(d_sr(n_x) * d_sr(n_x)).^2))…
% /(1+Ps * gama0 * x /((x+a)d_sr(n_x).^2) + y * gama0 /d_rd(n_x).^2) ) )
% subject to
% y <= B+(1+Ps
gama0/d_sr(n_x).^2)delta(1-x);
% 0<= x <=1;
% y>=0;

minimize ( -.5* (-rel_entr(1,(1 + Psgama +…
(Ps * gama0.^2 * y * x /((x+a)
(d_sr(n_x) * d_sr(n_x)).^2))…
/(1+Ps * gama0 * x /((x+a)d_sr(n_x).^2) + y * gama0 /d_rd(n_x).^2) ) )))
subject to
y <= B+(1+Ps
gama0/d_sr(n_x).^2)delta(1-x);
0<= x <=1;
y>=0;

cvx_end

this Error is apear:
Error using .* (line 262)
Disciplined convex programming
error:
square.

Error in * (line 36)
z = feval( oper, x, y );

Error in Untitled (line 36)
(Ps * gama0.^2 * y * x
/((x+a)*(d_sr(n_x) *
d_sr(n_x)).^2))…

The statement which triggered the error has `y*x`, which is the product of two variables, which violates CVX’s rules. You can not enter the problem directly as you have shown it. I don’t know whether it is possible to reformulate to be enterable into CVX, even if we give you the benefit of the doubt that it really is concave. I suggest you re-read Appendix B, whatever that is, and study the proof of concavity. And look at the rest of the paper or book to see what it suggests about using the Lagrange dual method.

In Appendix B calculate hessian of x×y/(x+y) and prove that is concave.
The paper is calculated with dual lagrange method but i want to solve with cvx…
Thanks a lot for response.

I don’t know whether this problem cam be handled by CVX. Please read the link I provided.