📄 sc15_rev.m
字号:
%Revised code sc01.m%Differences: 1) corrected position of RAKE fingers: ind_sin, ind_in% 2) modified definitions of MSINR via double inversion% (minor comment)% 3) SINR computed only for sir_input=0 dB, snr_input=10 dB% (very minor comment)% main program for ES-D, ES-DD, BS-DD --- w/ or w/o self-decorrelator% flags: % ES-D --- BS=0 & DD=0 % ES-DD --- BS=0 & DD=1 % BS-DD --- BS=1 & DD=1 clear;TrialAll = 5*10^(4);BS = 0; DD = 0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TO DEFINE THE INCIDENT SIGNALS' MULTIPATH PARAMETERS:%L = 2; % time samples per chipdelay_spread = (7)*L; % maximum delay spread, in time samples% to define the receiving antenna array:sensors = [0 0.5 1.5 2]';%(0 : 0.5 : 1.5).';% DOA --- each row a different source, each column a multipathmain_groupusr = 4;minor_groupusr = 16;theta = [0, 30; 25, -20; -25, -60; -70, 60]*pi/180; % 4 users randn('state',1);theta = [theta; (1:16)'/16*60*pi/180 -(1:16)'/16*60*pi/180];%theta = [theta;round((randn(16,2)-0.5)*60)*pi/180]; %16 users% total users =20% fixed SIR of the minor group of usersfix_sir = 25; %in dBM = 7; % # of information-data-symbol intervals of each space-time processing block% to load SOI's signature sequence[SrcAll, PathAll] = size(theta);load soi_code.matNc = length(soi_code)/L; % chips per information symbol (# of chips in signature sequence)Ns = length(soi_code);% To divide into the S+I+N segment and the I+N segment:P = floor(Nc * L /delay_spread)-1; % P-fold redundance in I+N delay segemntind_sin = [];ind_in = [];for m = 1:M %%%% THIS IS CORRECT VERSION % the S+I+N delay segment: ind_sin = [ind_sin m*Nc*L : m*Nc*L+delay_spread-1]; % the I+N delay segment --- truncated to integral numbers of delay-spread intervals: ind_in = [ind_in m*Nc*L+delay_spread : m*Nc*L+(P+1)*delay_spread-1]; end;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% THE SELF-DECORRELATOR:%% to generate an orthogonal projection used by the self-decorrelator: S0 = zeros(Nc*L,1);Si = S0;Sj = S0;%S = code(1,:).';S = soi_code.';% Assuming a chip-synchronous model for the multi-user CDMA cellular system:% otherwise, the step size below is not L, but 1.for ix = 1 : delay_spread Si(1 :ix, 1) = S0(Nc*L-ix+1 :Nc*L, 1); Si(ix+1:Nc*L, 1) = soi_code(1,1 :Nc*L-ix).'; Sj(1 :ix, 1) = soi_code(1,Nc*L-ix+1:Nc*L).'; Sj(ix+1:Nc*L, 1) = S0(1 :Nc*L-ix, 1); S = [S,Si,Sj];end;PS = (S / (S'*S)) * S';PSC = eye(L*Nc) - PS;clear PS S Si Sj SO;snr = 10; sir = -10; snr_input = -20:10:20; % in dB sir_input = [-15 -10 ]; %-1; %-20:10:20; % in dB%MM=[3 5 7 9 13 18 24 30];%for snr = 1:length(snr_input)%for sir = 1:length(sir_input)ox=sir_input;table=ox'*zeros(1,11);for par1=1:length(ox) sir=ox(par1); [SINR,BER] = self_deco(soi_code, PSC, P, M, ind_sin, ind_in, delay_spread, L, sensors, snr, sir, theta, BS, DD, TrialAll,main_groupusr,minor_groupusr,fix_sir);% czr_avin = 1./mean(1./SINR(1,:)); % CZR's original algorithm% czr_av = mean(SINR(1,:)); % CZR's original algorithm% czr_med = median(SINR(1,:)); % CZR's original algorithm% czr_sd = std(SINR(1,:));% hyp_avin = 1./mean(1./SINR(2,:)); % hypothetical case w/o SOI in I+N delay segments% hyp_av = mean(SINR(2,:)); % hypothetical case w/o SOI in I+N delay segments% hyp_med = mean(SINR(2,:)); % hypothetical case w/o SOI in I+N delay segments% hyp_av = 1./mean(1./SINR(2,:)); % hypothetical case w/o SOI in I+N delay segments% hyp_sd = std(SINR(2,:));% sd_av = 1./mean(1./SINR(3,:)); % CZR w/ self-decorrelator pre-processing% sd_sd = std(SINR(3,:));% in_av = 1./mean(1./SINR(4,:)); % input SINR% in_sd = std(SINR(4,:)); % SINRemp=10*log10([mean(SINR') median(SINR') 1./mean(1./SINR')]); % SINRth = 10*log10(... % analysis(Nc, Ns, P, M, delay_spread, L, sensors, snr, sir, theta, main_groupusr,minor_groupusr,fix_sir)) % table(par1,:)=[SINRemp SINRth BER']; table(par1,:) = [SINR' BER'];% table(par1,:)=[czr_av hyp_av sd_av in_av SINRth]% save scenario01.mat in_sd in_av sd_av czr_av hyp_av sd_sd czr_sd hyp_sd snr_input sir_input ...% L M delay_spread sensors theta TrialAll BS DD; save scenario15.mat table;end; % for sir%tb=(table);%subplot(3,1,1)%semilogy(ox,tb(:,17),'-',ox,tb(:,19),'--',ox,tb(:,18),'-.')%xlabel('SIR, dB');%ylabel('BER')%legend('WLLZ','SD')%subplot(3,1,2)%plot(ox,tb(:,9),'-',ox,tb(:,11),'--',ox,tb(:,12),'-.',...%ox,tb(:,13),'x',ox,tb(:,15),'o',ox,tb(:,16),'h')%xlabel('SIR, dB');%ylabel('Harmonic Mean Beamformer''s Output SINR, dB');%subplot(3,1,3)%plot(ox,tb(:,1),'x',ox,tb(:,3),'o',ox,tb(:,4),'-.',...%ox,tb(:,13),'+',ox,tb(:,14),'s',... %ox,tb(:,15),'o',...%ox,tb(:,13),'--',ox,tb(:,14),'--',ox,tb(:,1),'-',ox,tb(:,3),'-')%xlabel('SIR, dB');%ylabel('Mean Beamformer''s Output SINR, dB');%legend('WLLZ','SD','INPUT SINR','ANALYSIS - WLLZ','ANALYSIS - SD'); %,...%'NON-ASYMP. ANALYSIS')%mesh(-20:10:20, -20:10:20, 10*log10(sd_av))%xlabel('SIR, dB');%ylabel('SNR, dB');%zlabel('Beamformer''s Output SINR, dB');%print sd_av.ps;%figure(1);clf%hyp_av = 10*log10(hyp_av);%sd_av = 10*log10(sd_av);%czr_av = 10*log10(czr_av);%in_av = 10*log10(in_av);%plot(sir_input,sd_av(4,:),'-', sir_input,czr_av(4,:),'--', sir_input,hyp_av(4,:),':', ...% sir_input,in_av(4,:),'-.');%xlabel('Input SIR, in dB');%ylabel('Mean SINR at Beamformer''s Output, in dB');%gtext(['dotted: hypothetically w/o SOI in I+N delay segment']);%gtext(['solid: w/ self-decorrelator']);%gtext(['dashed: original algorithm']);%gtext(['dash-dot: beamformer''s input SINR']);%gtext(['SNR = 10 dB']);%print SNR010dB.ps;%figure(2);clf%plot(snr_input,sd_av(:,2),'-', snr_input,czr_av(:,2),'--', snr_input,hyp_av(:,2),':', ...% snr_input,in_av(:,2),'-.');%xlabel('Input SNR, in dB');%ylabel('Mean SINR at Beamformer''s Output, in dB');%gtext(['dotted: hypothetically w/o SOI in I+N delay segment']);%gtext(['solid: w/ self-decorrelator']);%gtext(['dashed: original algorithm']);%gtext(['dash-dot: beamformer''s input SINR']);%gtext(['SIR = -10 dB']);%print SIR-10dB.ps;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -