📄 comparisons of bit error probabilities with increasing number of users.m
字号:
m = 3;
N = 2^m-1; %system processing gain
maxbits = 20000;
maxusers = floor(1.5*N); % max number of users
S_tot = signature_matrix(m,maxusers);%generate signature matrix.
%S(:,k)=sk normalized to unit energy
noisevar = 1;
SNR = 10; %SNR in dB for each user
for K=1:maxusers % Increasing number of users
A = eye(K)*sqrt(10^(SNR/10)); % amplitude (power) of the users
S = S_tot(:,1:K);
M = zeros(N,K);
totalbits = floor(maxbits/K);
trainbits=0.05*totalbits;
for num_bits = 1:totalbits
b(:,num_bits) = sign(normrnd(zeros(K,1),1)); %generate random bit values for each
%user
b_frame = b(:,num_bits); %bits of users in num_bits'th frame duration
n = normrnd(0,sqrt(noisevar),N,1); %Assume zero mean AWGN
y_noisefree = S*A*b(:,num_bits); %generate received vector (after demodulation)
y = awgn(y_noisefree,SNR,'measured'); %add noise to received signal
% Begin of Adaptive DIC Method
w=1;
if num_bits<=trainbits % training mode for adaptive DIC
[b_ADIC(:,num_bits), w] = MUD_ADIC(y,S,A,w,b_frame,num_bits);
else %detection mode for adaptive DIC
[b_ADIC(:,num_bits), w] = MUD_ADIC(y,S,A,w);
end
% End of Adaptive DIC Method
% Begin of Adaptive MMSE Method
if num_bits<=trainbits %training mode for adaptive MMSE
[b_AMMSE(:,num_bits), M, mse(num_bits)] =
MUD_AMMSE(y,M,b_frame,num_bits);
else %detection mode for adaptive MMSE
[b_AMMSE(:,num_bits), M, temp] = MUD_AMMSE(y,M);
mse(num_bits) = (temp-b_frame)'*(temp-b_frame); %calculate actual squared
%error
end
% End of Adaptive MMSE Method
b_MF(:,num_bits) = MUD_MF(y,S); %Single User Matched Filter Detection
b_PIC(:,num_bits) = MUD_PIC(y,S,A); %Multiuser Optimum Detection
b_Dec(:,num_bits) = MUD_Dec(y,S); %Multiuser Decorrelator
b_MMSE(:,num_bits) = MUD_MMSE(y,S,A,noisevar);%Multiuser Minimum
%Mean Square Error Detection
b_SIC(:,num_bits) = MUD_SIC(y,S,A); %Multiuser Successive Interference
%Cancellation
end
e_MF = b-b_MF; % error calculation for MF
e_PIC = b-b_PIC; % error calculation for PIC
e_Dec = b-b_Dec; % error calculation for Dec
e_MMSE = b-b_MMSE; % error calculation for MMSE
e_SIC = b-b_SIC; % error calculation for SIC
e_ADIC = b(:,trainbits+1:totalbits)-b_ADIC(:,trainbits+1:totalbits); % error calculation
for ADIC
e_AMMSE = b(:,trainbits+1:totalbits)-b_AMMSE(:,trainbits+1:totalbits); % error
%calculation for AMMSE
Pe_MF(K) = length(find(e_MF))/(K*totalbits); % Probability of error for MF
Pe_PIC(K) = length(find(e_PIC))/(K*totalbits); % Probability of error for PIC
Pe_Dec(K) = length(find(e_Dec))/(K*totalbits);% Probability of error for Dec
Pe_MMSE(K) = length(find(e_MMSE))/(K*totalbits);% Probability of error for
%MMSE
Pe_SIC(K) = length(find(e_SIC))/(K*totalbits);% Probability of error for SIC
Pe_ADIC(K) = length(find(e_ADIC))/(K*(totalbits-trainbits));% Probability of error
%for ADIC
Pe_AMMSE(K) = length(find(e_AMMSE))/(K*(totalbits-trainbits));% Probability of
%error for AMMSE
K
clear b b_MF b_PIC b_Dec b_MMSE b_SIC b_ADIC b_AMMSE n y_noisefree A S
end
K=1:maxusers;
semilogy(K,Pe_MF,K,Pe_PIC,K,Pe_Dec,K,Pe_MMSE,K,Pe_SIC,K,Pe_ADIC,K,Pe_AM
MSE)
legend('MF','PIC','Dec','MMSE','SIC','ADIC','AMMSE');
title('Comparison of Bit Error Probabilities');
xlabel(['Number of users, SNR=9dB ,K for N = ',num2str(N)]);
ylabel('Bit error Probability, P_b');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -