```
clear
clc
num_bits=100000;
num_itera=20;
W=1.25e6;
N=10^(-174/10);
omega_c=1;
omega_d=1;
P_0=100;
Rc_min=10;
Rd_min=10;
Pc_max=250;
Pd_max=250;
err=10^(-6);
arf_ck=0.4;
arf_dk=0.5;
P_ck=10^(-4);
P_dk=10^(-5);
c_0=10^(-2);
n=4;
xi_cb=(abs(sqrt(0.5)*(exprnd(1,1,num_bits)+1i*exprnd(1,1,num_bits)))).^2;
xi_dd=(abs(sqrt(0.5)*(exprnd(1,1,num_bits)+1i*exprnd(1,1,num_bits)))).^2;
beta_cb=(abs(sqrt(0.5)*(lognrnd(0,10^0.8,1,num_bits)+1i*lognrnd(0,10^0.8,1,num_bits)))).^2;
beta_dd=(abs(sqrt(0.5)*(lognrnd(0,10^0.8,1,num_bits)+1i*lognrnd(0,10^0.8,1,num_bits)))).^2;
d_cb=80;
d_dd=90;
g_cb=c_0*xi_cb.*beta_cb*d_cb^(-n);
g_dd=c_0*xi_dd.*beta_dd*d_dd^(-n);
g_cb=mean(g_cb(:));
g_dd=mean(g_dd(:));
%******************************************************%
for k=1:1:num_itera
lambda(k)=(omega_c*arf_ck*W*log2(1+P_ck*g_cb/(arf_ck*N*W))+omega_d*arf_dk*W*log2(1+P_dk*g_dd/(arf_dk*N*W)))/(P_ck+P_dk+2*P_0);
cvx_begin
variables arf_c arf_d P_c P_d
maximize 1/log(2)*(omega_c*arf_c*W*log(1+P_c*g_cb/(arf_c*N*W))+omega_d*arf_d*W*log(1+P_d*g_dd/(arf_d*N*W)))-lambda(k)*(P_c+P_d+2*P_0)
subject to
arf_c+arf_d<=1;
arf_c*W*log2(1+P_c*g_cb/arf_c*N*W)>=Rc_min;
arf_d*W*log2(1+P_d*g_dd/arf_d*N*W)>=Rd_min;
P_c<=Pc_max;
P_d<=Pd_max;
P_c>=0;
P_d>=0;
arf_c>=0;
arf_d>=0;
cvx_end
if abs(omega_c*arf_c*W*log2(1+P_c*g_cb/(arf_c*N*W))+omega_d*arf_d*W*log2(1+P_d*g_dd/(arf_d*N*W))-lambda(k)*(P_c+P_d+2*P_0))<err
break
else
arf_ck=arf_c
arf_dk=arf_d
P_ck=P_c
P_dk=P_d
end
end
```

above all is my code and the error disciplined as:Cannot perform the operation: {real affine} ./ {real affine}.I have do it for some days and remain this problem.I need help,thanks