The considered problem is a joint power and beam allocation problem for MIMO-NOMA system.

G and H_ are complex matrix with size of (Nt-N+1,Nt-N+1,N) and (Nt-N+1,Nt-N+1,N, N), respectively. The main code are as below:

cvx_begin sdp

% cvx_precision high

cvx_solver sedumi

variables rou(N) t(N) a(N)

```
for i = 1:N
eval(['variable Q',num2str(i),'(Nt-N+1,Nt-N+1) symmetric']);
end
expression r
r = 0;
for i = 1:N
r = r+log(1+rou(i))/log(2);
end
maximize( r )
subject to:
for i = 1:N
eval(['det_rootn([a(i),t(i);t(i),trace(G(:,:,i)*Q',num2str(i),')])>=0;']);
t_(i)^2+2*t_(i)*(t(i)-t_(i))-rou(i)>=0;
eval(['real(2/(gama+1)*(trace(G(:,:,i)*Q',num2str(i),')-gama))-pow_abs(trace(G(:,:,i)*Q',num2str(i),')/c(i),2)-pow_abs(a(i)*c(i),2)>=0;']);
eval(['Q',num2str(i),' == semidefinite(Nt-N+1);']);
rou(i)>=0;
% a(i)>=0;
0.1-a(i)>=0;
end
expression z(1,N)
for k = 1:N
z(k) = 0;
for i = 1:N
if i~=k
eval(['z(k)= z(k) + trace(H_(:,:,i,k)*Q',num2str(i),');']);
end
end
eval(['real(2/(gama+1)*(trace(H_(:,:,k,k)*Q',num2str(k),')-gama*z(k)-gama))-pow_abs(trace(H_(:,:,k,k)*Q',num2str(k),')/d(k),2)-pow_abs(a(k)*d(k),2)>=0; ']);
end
expression pp
pp = 0;
for i = 1: N
eval([' pp = pp + trace(Q',num2str(i),');']);
end
P-pp>=0;
cvx_end
```