⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bercalculationforlinearmultiuserdetector.m

📁 线性DS-CDMA多用户检测算法误码率比较Matlab程序。
💻 M
字号:
m = 3; 
N = 2^m-1; %system processing gain 
maxbits = 20000; 
maxusers = floor(1.5*N); 
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 %number of users 
A = eye(K)*sqrt(10^(SNR/10)); 
S = S_tot(:,1: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 
 
b_MF (:, num_bits) = MUD_MF(y,S); %Single User Matched Filter Detection 
b_OD (:, num_bits) = MUD_OD(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 %
end 
e_MF = b-b_MF; % calculate the errors made for MF  
e_OD = b-b_OD; % calculate the errors made for Optimum Detector 
e_Dec = b-b_Dec; % calculate the errors made for Decorrelator 
e_MMSE = b-b_MMSE; % calculate the errors made for MMSE detector 
 
 
Pe_MF(K) = length(find(e_MF))/(K*totalbits); % calculate the Probability of error for 
MF 
Pe_OD(K) = length(find(e_OD))/(K*totalbits); % calculate the Probability of error for 
Optimum Detector 
Pe_Dec(K) = length(find(e_Dec))/(K*totalbits); % calculate the Probability of error for 
Decorrelator 
Pe_MMSE(K) = length(find(e_MMSE))/(K*totalbits); % calculate the Probability of 
error for MMSE 
 
K % Counting for keeping Track of Simulation 
clear b b_MF b_Dec b_MMSE b_OD n y_noisefree A S 
end 
K=1:maxusers; 
semilogy(K,Pe_MF,K,Pe_OD,K,Pe_Dec,K,Pe_MMSE) 
legend('MF','OD','Dec','MMSE'); 
title('Comparison of Bit Error Probabilities'); 
xlabel(['Number of users, SNR=10dB ,K for N = ',num2str(N)]); 
ylabel('Bit error Probability, P_b'); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -