Dear everyone,

I encounter one problem in CVX. The matlab code is provided below.

function [ L_mu,L_u,L_um,Rho,Objective] = BitOptimizationWithfixedScheduling()

```
global h_G2U EU k L N SNR_um SNR_mu C gamma T B delta1
cvx_begin
cvx_solver mosek
variable Rho
variable L_mu(N-2,1) nonnegative
variable L_um(N-2,1) nonnegative
variable L_u(N-2,1) nonnegative
expression E_mu(N-2,1)
expression E_m
expression E_u(N-2,1)
expression E_um(N-2,1)
%%
for n=1:N-2
E_um(n,1)=(2^(L_um(n,1)/(B*delta1))-1)*h_G2U(n+2,1)^2*delta1/SNR_um;
end
for n=1:N-2
E_u(n,1)=ComputEnergy(L_u(n,1));
end
%%
E_m=C^3*gamma*pow_pos(Rho*L,3)./T^2;
for n=1:N-2
E_mu(n,1)=CommunEnergy(L_mu(n,1), h_G2U(n,1),SNR_mu);
end
% %%
minimize sum(E_mu)+E_m
subject to
sum(E_um)+sum(E_u)<=EU;
for n=1:N-2
sum(L_u(1:n,1))<=sum(L_mu(1:n,1));
end
for n=1:N-2
sum(L_um(1:n,1))<=k*sum(L_u(1:n,1));
end
sum(L_mu)==(1-Rho)*L;
sum(L_u)==(1-Rho)*L;
sum(L_um)==k*(1-Rho)*L;
0<=Rho<=1;
cvx_end
Objective=cvx_optval;
end
```

%%%%%%%%%%%%%%%%%%%%%%%%

Maltab window shows CVX index exceeds matrix dimensions.

I have carefully checked the matrix dimension one by one, and find the dimensions of matrices are well matched. what’s wrong with it ?

The other parameters are scalar variables, which is given as following

Hope someone can help me, thanks in advance.