# CVX problem of 2 variables

This my code of 2 variables and 2 constraints but getting problem .As my obj. funtion is convex .please help me .
clc;
clear all;
Treq=22.210^-6;
Tframe=50
10^-3;
Tack=7.510^-6;
BIFS=7.5
10^-6;
L=100;
Ttran=110^-3;
R=1.728
10^6;
SIFS=2.510^-6;
Sidle=Treq+BIFS;
Scoll=Sidle;
Ssucc=Treq+SIFS+Tack+BIFS;
cvx_begin
variable M
variable p
Tcop=M
((Sidle/(L.*p))+Ssucc+((1./((L.p)((1-p)^(L-1)))-(1./(L.*p)-1))*Scoll));
minimize -(M.RTtran)
subject to
Tcop+M.Ttran <= Tframe;
0 <= p <= 1;
cvx_end
disp('values are ');
disp(M);
disp§;
disp(Tcop)
ERROR:
Error using .
(line 173)
Disciplined convex programming error:
Cannot perform the operation: {positive constant} ./ {real affine}

Error in ./ (line 19)
z = times( x, y, ‘./’ );

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

Error in / (line 15)
z = mtimes( x, y, ‘rdivide’ );

Error in iit (line 17)
Tcop=M*((Sidle/(L.*p))+Ssucc+((1./((L.p)((1-p)^(L-1)))-(1./(L.*p)-1))*Scoll));

The objective function is linear, which is convex. But the constraint `Tcop+M*Ttran <= Tframe` is not convex. So your problem is non-convex, and can not be modeled or solved using CVX.

My calculation of the eigenvalues of the Hessian of `Tcop+M*Ttran` with respect to M and p show that it is indefinite. i.e., is neither convex nor concave. Therefore the constraint is non-convex.

What i have to do as to solve this problem using cvx only .Actully when i take only M as as variable it is solved by cvx but adding p will show error .If constarint is non convex then it should not even solve problem for 1 variable also . Plz suggest me how i can solve the problem using cvx only

You can not solve this problem in CVX. You will have to use a non-convex nonlinear solver.

Your objective function and constraints must be jointly convex in all variables, not just convex in one variable at a time. For instance, `x*y` is convex in `x` if `y` is not a CVX variable, but it is not jointly convex in `x` and `y`.

[2] Yi Liu, Chau Yuen, Jiming Chen and Xianghui Cao. “A scalable hybrid MAC protocol for massive M2M networks”. Presented at Wireless Communications and Networking Conference (WCNC), 2013 IEEE. 2013, . DOI: 10.1109/WCNC.2013.6554572.
this paper the same problem is solved by cvx tool only on page 252 please once you see to it and please if possible please generate the code for it (equation no.-6,7,8 on page 252)

I don’t have access to the paper, so I have no idea what the authors did. The burden is on you to provide a convex optimization problem, which you have not done.

Anyways thanks Mark for your valuable response