%Massive MIMO Demonstration (with 2 users)
%Number of antennas in the Basestation is assumed as 10000
res=[];
for M=10:100:10000
cv=[randn(1000,1)+j*randn(1000,1) randn(1000,1)+j*randn(1000,1)];
res=[res abs((cv(:,1)'*cv(:,2))/M)];
end
figure
plot(10:100:10000,res)
title('Demonstration of attainment of orthogonality of channel vectors(with unit magnitude) as M increases in Massive MIMO')
%datasamples (DS)
ds=1000;
S1=sign(((rand(ds,1)*2-1)))+j*sign(((rand(ds,1)*2-1)));
S2=sign(((rand(ds,1)*2-1)))+j*sign(((rand(ds,1)*2-1)));
S1=S1./sqrt(2);
S2=S2./sqrt(2);
SNRdB=0:10:30;
p=1;
for p=1:1:length(SNRdB)
v=1/(10^(SNRdB(p)/10));
POS=[];
for q=100:100:1000
h1=0.01*(randn(q,1)+j*randn(q,1));
h2=0.01*(randn(q,1)+j*randn(q,1));
R=[];
for r=1:1:ds;
R=[R h1*S1(r)+h2*S2(r)+sqrt(v)*(randn(q,1)+j*randn(q,1))];
end
%Combiner to detect S1 with perfect CSI
S1_predicted=[];
for i=1:1:ds
S1_predicted=[S1_predicted sign(real(h1'*R(:,i)))+j*sign(imag(h1'*R(:,i)))];
end
temp=sign(real(S1))+j*sign(imag(S1));
POS=[POS length(find((transpose(temp)-S1_predicted)==0))/length(S1)]
end
subplot(2,2,p)
plot(100:100:1000,POS*100)
xlabel('Number of antennas in the basestation')
ylabel('Detection rate in percentage')
title(num2str(SNRdB(p)))
p=p+1;
end
%RX data corresponding to the first set of data
TX1=S1(1);
TX2=S2(1);
RX=R(:,1);
D1=h1’*RX;
D2=h2’*RX;
figure
plot(real(TX1),imag(TX1),'b*');
hold on
plot(real(TX2),imag(TX2),'r*');
plot(real(D1),imag(D1),'bo');
plot(real(D2),imag(D2),'ro');
hold on
plot(real(RX),imag(RX),'k*')
