📄 vus_stbc_4_32.m
字号:
% BER of the VUS-MUMIMO-SM Uplink System - Rayleigh ()
% 8 Real Users - 16 Virtual Users - 4 Best Virtual Users
clc
clear all
close all
R_users = 6; % Number of real users
Tx = 2; % Number of Tx antennas for each real user
V_users = R_users * Tx; % Number of virtual users
N = 4 * 10 ^ ( 4 ); % Number of bits
Ns = N / 2; % Number of symbols
SNR = -5 : 2.5 : 10; % in dB
snr = 10 .^ ( SNR / 10 );
% % Map-H matrix index array and Greate Sk input array --??????????????
load X_index_snr_4_32_20000_Final
user_index = zeros( R_users, Ns, length( SNR ) );
for i = 1 : length( SNR )
for t = 1 : Ns
for k = 1 : R_users
if ( X_index_snr( ( 2 * k - 1 ), t, i ) + X_index_snr( ( 2 * k ), t, i ) ) > 0
user_index( k, t, i ) = 1;
end
end
end
% users6( i ) = ( Ns - length( find( sum( user_index( :, :, i ) ) - 4 ) ) ) / Ns;
end
% Create Inputs
for n = 1 : V_users
sk_bin( n, : ) = randint( 1, N );
sk_polar = sk_bin( n, : ) * 2 - 1;
for i = 1 : Ns
sk_complex( n, i ) = ( 1 / sqrt( 2 ) ) * complex( sk_polar( 2 * i - 1 ), sk_polar( 2 * i ) );
end
end
load H_4_32_20000
% STBC Encoding
% Assume the H matrix of time slot 1 and time slot 2 are identical
ErrorTxbits = zeros( 1, Ns, length( SNR) );
for p = 1 : length( SNR )
for t = 1 : Ns
if ( sum( user_index( :, t, p ) ) ) == 2 % 2 selected users
u = find( user_index( :, t, p ) ); % find the selected 2 users from four users
h2 = [ H( :, ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ), H( :, ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ) ];
x2 = [ sk_complex( ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ); sk_complex( ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ) ];
ET = STBC_R4_T4_ED( h2, x2, SNR( p ) );
ErrorTxbits( 1, t, p ) = ET( 1, 1 );
ErrorTxbits( 2, t, p ) = ET( 2, 1 );
end
if ( sum( user_index( :, t, p ) ) ) == 3 % 3 selected users
u = find( user_index( :, t, p ) ); % find the selected 3 users from four users
h3 = [ H( :, ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ), H( :, ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ), H( :, ( 2 * u( 3 ) - 1 ) : ( 2 * u( 3 ) ), t ) ];
x3 = [ sk_complex( ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ); sk_complex( ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ); sk_complex( ( 2 * u( 3 ) - 1 ) : ( 2 * u( 3 ) ), t ) ];
ET = STBC_R4_T6_ED( h3, x3, SNR( p ) );
ErrorTxbits( 1, t, p ) = ET( 1, 1 );
ErrorTxbits( 2, t, p ) = ET( 2, 1 );
end
if ( sum( user_index( :, t, p ) ) ) == 4 % 4 selected users
u = find( user_index( :, t, p ) ); % find the selected 3 users from four users
h4 = [ H( :, ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ), H( :, ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ), H( :, ( 2 * u( 3 ) - 1 ) : ( 2 * u( 3 ) ), t ), H( :, ( 2 * u( 4 ) - 1 ) : ( 2 * u( 4 ) ), t ) ];
x4 = [ sk_complex( ( 2 * u( 1 ) - 1 ) : ( 2 * u( 1 ) ), t ); sk_complex( ( 2 * u( 2 ) - 1 ) : ( 2 * u( 2 ) ), t ); sk_complex( ( 2 * u( 3 ) - 1 ) : ( 2 * u( 3 ) ), t ); sk_complex( ( 2 * u( 4 ) - 1 ) : ( 2 * u( 4 ) ), t ) ];
ET = STBC_R4_T8_ED( h4, x4, SNR( p ) );
ErrorTxbits( 1, t, p ) = ET( 1, 1 );
ErrorTxbits( 2, t, p ) = ET( 2, 1 );
end
end
BER_VUS_MIMO_STBC_4_32_Final( p ) = sum( ErrorTxbits( 1, :, p ) ) / sum( ErrorTxbits( 2, :, p ) );
end
save BER_VUS_MIMO_STBC_4_32_Final BER_VUS_MIMO_STBC_4_32_Final
figure,
semilogy( SNR, BER_VUS_MIMO_STBC_4_32_Final, 'g-*' )
axis( [ -5 10 10 ^ ( -6 ) 10 ^ 0 ] );
title( ' The BER of VUS-MUMIMO-STBC-4-32 (20000 Time Slots) ' )
xlabel( ' SNR in dB ')
ylabel( ' BER ' )
legend( ' MLD-STBC-4-32 - Monte Carlo ')
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -