```
cvx_clear
cvx_begin
variables X(N,1) Y(N,D)
expressions V(N,1) U(N,1) T(D,1) W(D,1) M(N,D) Z(N,D) A(D,1) Q(D,1) S(D,1)
for n=1:N
U(n,1) = X(n,1):
V(n,1) = 1;
for i=1:D
A(i)=1;
Q(i)=1;
V(n,1) = V(n,1) + Y(n,i)*H_d(n,1,i);
end
V(n,1) = Rmin(n,1)*V(n,1)-X(n,1)*H_c(1,n);
end
for i=1:D
for n=1:N
for j=1:D
M(n,i) = M(n,i) +Y(n,j)*H_d(n,i+1,j)+1;
end
Z(n,i) =M(n,i)-Y(n,i)*H_d(n,i+1,i);
end
end
for i=1:D
for n=1:N
A(i,1)=A(i,1)*Z(n,i);
Q(i,1)=Q(i,1)*M(n,i);
end
T(i,1)=Rreq*A(i,1)-Q(i,1);
end
W(:,1) = X(1,1);
for d=1:D
for i=((d-1)*N+1):d*N
W(d,1) = W(d,1) + Y(i,1); % sum power consumption of the D2D transmitter d
end
end
W(:,1) = W(:,1) - X(1,1);
minimize (sum(X)+sum(Y))
subject to
V <= 0;
U <= Pn_max;
W <= Pd_max;
T <= 0;
X >= 0;
Y >= 0;
cvx_end
```

I just wanna todo the prod(M) and prod(Z),but can not find a way ! help! please