I am getting ‘conversion to double from Cvx not possible’ error in the line “Rcup_kmn(k,m,n) = Blog2(1 + X/Y)+ ex_diff(1)(c_q(m,n,1,1) - ex_q(1)) + ex_diff(2)*(c_q(m,n,1,2) - ex_q(2));” i used expression holders. Can you help me with what I might be missing?
run(‘init.m’);
cvx_begin
variable c_q(M,N, 1,2);
Rcup_kmn = R_kmn;
for k = 1:K
for m = 1:K
for n = 1:N
D1 = norm(reshape(q(m,n,:,:),[1 2]) -W_k(k,:),2)^2 + H^2;
D2 = norm(reshape(q(m,n,:,:),[1 2]) -W_m,2)^2 + (H - H_m)^2;
X = P_DU(k,m,n) * P_UM(m,n) * h_0/sigma2;
Y = P_DU(k,m,n) * D2 + P_UM(m,n)D1;
diff = -1(BX /(log(2)(Y+X)Y)) * (P_DU(k,m,n) (reshape(q(m,n,:,:),[1 2]) -W_m ) - P_UM(m,n)(reshape(q(m,n,:,:),[1 2])- W_k(k,:)));
expression ex_diff(2);
ex_diff(1) = diff(1,1);ex_diff(2) = diff(1,2);
expression ex_q(1,2);
ex_q(1) = q(m,n,1,1); ex_q(2) = q(m,n,1,2);
Rcup_kmn(k,m,n) = Blog2(1 + X/Y)+ ex_diff(1)(c_q(m,n,1,1) - ex_q(1)) + ex_diff(2)(c_q(m,n,1,2) - ex_q(2));
end
end
end
Rcup = (1/N) * sum(a.*Rcup_kmn, 3);
aR = a .* Rcup;
LO = L_k .* (1+O_k);
expression temp_E;
ds_h = delta*sigma2/h_0;
for k = 1:K
for m = 1:M
for n = 1:N
temp_E = temp_E + a(k,m,n)*ds_h*(H^2 + pow_pos(norm(reshape(c_q(m,n,:,:),[1 2]) -W_k(k,:),2),2))*(w_1*(2^(l_DU(k,m,n)/(delta*B_DU(k,m,n)))-1) + w_2*(2^(l_UK(k,m,n)/(delta*B_UK(k,m,n)))-1)) + w_2*ds_h*((H-H_m)^2 + pow_pos(norm(reshape(c_q(m,n,:,:),[1 2]) - W_m,2),2))*(2^(l_UM(k,m,n)/(delta*B_UM(k,m,n)))-1);
end
end
end
for m = M
for n = N-1
temp_E = temp_E + w_2*0.5*Q*Delta*(norm(reshape(c_q(m,n+1,:,:),[1 2])-reshape(c_q(m,n,:,:),[1 2])))^2;
end
end
minimize temp_E - zeta*(sum(Rcup_kmn(:))/N);
for m = 1:M
c_q(m,1,:,:) == c_q(m,N,:,:); %C6
end
for m = 1:M
for n = 1:N-1
norm(c_q(m,n+1,:,:) - c_q(m,n,:,:))^2 <= S_max^2; %C7
end
end
a .* dist2 <= H *sqrt(3); %C8
sum(LO) <= sum(aR(:)) <= C_max;%C10
for n = 1:N
for m = 1:M
for j = m+1:M
- norm(reshape(q(m,n,:,:),[1 2])-reshape(q(j,n,:,:),[1 2]))^2 + 2*(reshape(q(m,n,:,:),[1 2])-reshape(q(j,n,:,:),[1 2])) * transpose(reshape(c_q(m,n,:,:),[1 2])-reshape(c_q(j,n,:,:),[1 2])) >= d_min^2;
end
end
end
0 <= a <= 1; %C21
cvx_end
q = c_q;