# How i can fix the problem

Hello everyone!
Can you help me with the problem. When i run the codes here, it’s doesn;t work right because matlab CVX do not perform divide.

``````M = 7;
Nt = 8;
L = 5;
Pmax = 40;
u = 0.5;
sigma = -70;
delta = -50;
SNRdB = 10;
gamma = 10.^(SNRdB/10);
Iota = 40;
h = zeros(Nt,M);
g = zeros(Nt,L);
for i=1:M
h(:,i) =sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)); % Nt antenna to 1 SR
end
for i=1:L
g(:,i) =sqrt(1/2)*(randn(Nt,1)+1i*randn(Nt,1)); % Nt antenna to 1 PU
end

H = (h*ctranspose(h));
G = (g*ctranspose(g));
cvx_begin
variable W(Nt,Nt)
variable theta
minimize(0);
subject to
0 >= abs(trace(W))-Pmax;
0 >= gamma*sigma + gamma*(delta/theta) - abs(trace(H*W));
0 >= abs(trace(G*W)) - Iota;
0 < theta < 1;
W >= 0;
cvx_end
``````

------------------------------

**It’s appear the error. **

1 Like

The constraint
` 0 >= gamma*sigma + gamma*(delta/theta) - abs(trace(H*W));`
is not convex.

The term `gamma*(delta/theta)` can be rewritten as `gamma*delta*inv_pos(theta)` , but because `gamma*delta` is negative, that term is concave, and therefore makes the constraint non-convex.

Even if `gamma*delta` were positive, the term `-abs(trace(H*W)` is also concave, and makes the constraint non-convex.

If you have a typo, and really meant `>=` rather than `<=`, use of `inv_pos` would allow the constraint, and the whole program, to be accepted by CVX.

1 Like

I’m researching the topic “Simultaneous Wireless Information and Power Transfer Solutions for Energy Harvesting Fairness in Cognitive Multicast Systems”. I’m stuck in simulate the formula number 9 based on formula number 7 follow table 1 (in sec1 & 2)

Can you help me with the problem i said.
I’m looking forward to hearing from you

You are having trouble with (7d).

Your implementation has `abs`, but (7d) does not. That addresses one of the non-convexity sources.

Your other non-convexity source is because your `delta` is negative. It would seem `delta` should be positive, which would make the constraint convex.

Hello Mark.

I’m beginer when start CVX. It’s difficult for me to simulate. So can I get the code for this part from you? I’m looking forward from you.

Have a nice day Mark!

You need to do some work yourself. it is your project, not mine.

I toid you not to have the `abs` in the code. Additionally, your input data needs to be fixed (delta must be positive). i don’t know how the input data is determined, but that is for you to figure out.

More generally, Successive Convex Approximation is a very precarious endeavor, as I describe in various posts on this forum. When used by someone who is not a real expert, it often meets with failure.

2 Likes