-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add source code for MU-MIMO baseline
- Loading branch information
1 parent
6b724f4
commit a9fc72d
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
clc | ||
clear all | ||
close all | ||
|
||
|
||
|
||
num_subframe = 500000 | ||
num_sym = 100000 | ||
|
||
SNR = 0:2:27 | ||
for i = 1:length(SNR) | ||
if SNR(i)>19 | ||
num_sym=10000; | ||
end | ||
snr_linear = 10^(SNR(i)/10); | ||
sigma = sqrt(0.5/snr_linear); | ||
|
||
error = 0; | ||
parfor frame = 1: num_subframe | ||
|
||
sym = randi([0,3], 2, num_sym); | ||
x_sym = qammod(sym, 4,'UnitAveragePower', true); | ||
|
||
H = (rand(2,2)+1j * randn(2,2))/sqrt(2); | ||
|
||
x_tr = inv(H)*x_sym; | ||
|
||
|
||
Es = mean(mean(abs(x_tr).^2)); | ||
|
||
x_tr_norm = x_tr/sqrt(Es); | ||
|
||
|
||
noise = sigma*(randn(2,num_sym)+1j*(randn(2,num_sym))); | ||
x_rc = H * x_tr_norm + noise; | ||
|
||
|
||
|
||
|
||
to_decoder = x_rc * sqrt(Es);%% Normalize, such that can be decoded | ||
|
||
de_sym = qamdemod(to_decoder, 4, 'UnitAveragePower', true); | ||
|
||
correct = sum(sum((sym==de_sym),2)); | ||
|
||
err = 2*num_sym - correct; | ||
error = error+err; | ||
|
||
end | ||
|
||
SER(i) = error/(2*num_sym*num_subframe) | ||
|
||
end | ||
|
||
figure() | ||
semilogy(SNR, SER,'-*') | ||
grid on | ||
xlabel('SNR') | ||
ylabel('SER') |