%%%% User scheduling by fast user pairing algorithm in MU-MIMO
%%% by Shan Siyang 15/5/2011
clc;close all;clear all;
clear
Nt=20; %% the antenna number of the base station
Nr=1; %% the antenna number of each user
N=50; %% the number of users
Max_N=20; %% the max number of users
SNR_arr=[0:5:30];
Fram_arr=ones(1,size(SNR_arr,2))*1e2;
H_all=(randn(Nt,Nr*N)+1i*randn(Nt,Nr*N))/sqrt(2); %generate H matrix??Nt,Nr*N??
save H_all.mat H_all;
for snr=1:size(SNR_arr,2) %loop for different SNR
SNR=SNR_arr(snr); %turning snr to the original value
noise_power=10^(-SNR/10); %convert SNR to noise power
disp(['SNR:',num2str(SNR)]); %display the current SNR
tic
for frame=1:Fram_arr(snr) %loop for different frame
user_set2=[]; %create the user set
for user=1:N
N_tmp(user)=norm(H_all(:,user)); %calculate the norm of the vector
end
[tmp,index]=max(N_tmp); %find the max norm and the user
user_set2=[user_set2,index]; %write the user into the set
i_Nt=sqrt(noise_power)*eye(Nt); %i_Nt is order N unit matrix multiplied by square of noise power
G(:,1)=[H_all(:,user_set2);i_Nt(:,1)]; %obtain G(1)
Q(:,1)=G(:,1)/norm(G(:,1)); %obtain Q(1)
for n=2:Max_N
for user=1:N
h=[H_all(:,user);i_Nt(:,n)]; %obtain the column vector h(8*1)
tmp1=h'*h;
tmp2=h'*Q(:,1:n-1)*Q(:,1:n-1)'*h;
R_tmp(user)=sqrt(tmp1-tmp2); %calculate R(k+1,k+1)
end
R_tmp(user_set2)=0; %zero the value R of previous choosed users
[tmp,index]=max(R_tmp);
user_set2=[user_set2,index];
sum=0;
for i=1:n-1
h_tmp=[H_all(:,index);i_Nt(:,n)];
tmp3=Q(:,i)'*h_tmp*Q(:,i);
sum=sum+tmp3;
end
Q(:,n)=[H_all(:,index);i_Nt(:,n)]-sum; %orthogonalization of Q(n)
Q(:,n)=Q(:,n)/tmp; %unitization of Q(n)
if n==Max_N
H_fin=H_all(:,user_set2); %obtain the final user channel matrix
Capacity(frame)=abs(log2(det(eye(n)+H_fin'*H_fin/noise_power))); %calculate the final capacity of the user channel
end
end
end
disp([' Time:' num2str(toc) 'sec']);
mean_Capacity(snr)=mean(Capacity);
end
result_arr=[SNR_arr.',mean_Capacity.'];
plot(SNR_arr,mean_Capacity,'b-+');
grid on;
hold on;