pr4_15.m

来自「Spread Spectrum and CDMA Principles and 」· M 代码 · 共 20 行

M
20
字号
%Problem 4.15;
%simulating floor SNR and testing Gaussian appoximation of MAI;

clear all; close all;
N=80; K=20; %processing gain and number of users;
n=5000; %number of trials;
mai=[]; vrm=0; %starting MAI histogram and variance;
for k=1:n
    S=2*unidrnd(2,K,N)-3; %signature matrix;
    oum=sum(S(1,:)*S(2:K,:)'); %output MAI;
    mai=[mai,oum]; %array of MAI values;
    vrm=vrm+(oum^2)/n; %variance of MAI;
end; %array of MAI values over n trials and estimated variance are ready;
SIR=(N^2)/vrm, %experimental SIR;
WT=(SIR*(K-1))/2, %equivalent processing gain;
M=max(abs(mai)); %finds MAI range;
subplot(211); hist(mai,31); xlim([-M,M]); ylabel('number of values'); %histogram of MAI;
mai=sort(mai); %puts MAI in ascending order;
subplot(212);
plot(mai,normpdf(mai,0,sqrt(vrm))); xlim([-M,M]); ylabel('Gaussian PDF'); xlabel('MAI'); %plotting Gaussian approximation of MAI PDF;

⌨️ 快捷键说明

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