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

📄 pr10_18.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem10.18;
%Analysis of multiuser detectors: decorrelating and MMSE ones as compared
%to conventional algorithm;

clear all;
m=7; %set memory of m-sequence;
a1=bmsq(m)'; A1=a1; for k=1:2^m-2 A1=[A1,circshift(a1,k)]; end; %matrix of shifted m-sequences;
A1=[[A1,zeros(2^m-1,1)];zeros(1,2^m)]; %Hadamard matrix of size 2^m;
M=2^m; N=M-1; %set maximal number of users and spreading factor (M=2^m and N<=M);
A2=(-2*A1(1:N,:)+1)/sqrt(N); %signature ensemble for Welch-bound oversaturated (or orthogonal if K=N) system;
B=A2(:,1:N); %square matrix of K=N signatures;
A=B;  K=size(A,2); %specify choice of signature ensemble, options are: Welch-bound (A2) or square system (if K=N=M-1 shifts of m-sequence);
C=(A'*A); %signature correlation matrix;
q=raylrnd(1/sqrt(2),1,K); G=diag(q.^2); G(1,1)=1; %Rayleigh amplitudes of users' signals;
e1=[1,zeros(1,K-1)]; % sifting vector for the first user;
u(2,:)=A(:,1)'; if det(C)>1e-10 u(3,:)=e1*(C^-1)*A'; end; %conventional receiver and decorrelation references;
Q=0.5:0.25:25; %common SNR 
for k=1:length(Q)
    G2=(Q(k)^2)*G;
    u(1,:)=(e1*(C+G2^-1)^-1)*A'; %MMSE referene vector;
    for s=1:size(u,1)
        deteff(s,:)=G2*((u(s,:)*A).^2)'; %vector of signature powers at the output of MMSE(s=1),conventional(s=2) and decorrelating (s=3) detectors;
        SINR(s,k)=10*log10(deteff(s,1)/(sum(deteff(s,2:end))+norm(u(s,:))^2)); %SINR for MMSE, conventional and decorrelator receivers;
    end;
end;
Q=20*log10(Q);
KU=['SINR for three detectors, K=',num2str(K),', N=',num2str(N)]; %string for title;
plot(Q,SINR'); xlabel('1st user bit SNR, dB'); ylabel('SINR, dB'); xlim([Q(1),Q(end)]); grid;
if size(u,1)<3 legend('MMSE','Conv.',2); else legend('MMSE','Conv.','Decorr.',2); end; title(KU);

⌨️ 快捷键说明

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