pr7_38.m
来自「Spread Spectrum and CDMA Principles and 」· M 代码 · 共 22 行
M
22 行
%Problem 7.38;
%simulating oversaturated synchronous CDMA;
clear all; close all;
n=8; %set exponent of two in Hadamard matrix size;
K=2^n; %Hadamard matrix size;
N=242; %set signature length, N<K;
S=hadamard(K); %Hadamard matrix;
S=S(1:N,:); %signature matrix ready, signatures are columns;
Nmt=10000; Pr=0; %initialization of cycle in k;
for k=1:Nmt
B=2*unidrnd(2,1,K)-3; %data vector;
Y=B*S'; %group signal;
Dm=Y*S; %vector of correlations in all single-user receivers;
Be=sign(Dm); %decisions on received users bits;
x=find(B~=Be); %numbers of users with erroneus decisions;
Pr=Pr+length(x); %cumulative number of errors;
end;
fprintf('\n');
Pre=Pr/(K*Nmt); %bit error probability;
fprintf('bit error probability BER= %f',Pre);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?