📄 main.m
字号:
%IR-UWB MRC合并RAKE性能仿真
% function UWB_TH_PPM_SYMTEM_SIMULATON [ABER BBER CBER DBER EBER]=main
clc;
clear all;
tic;%clock
G_tx=1;%发射机仿真开关
G_channel=1;%信道仿真开关
G_rx=1;%接收机仿真开关
Pow = -30; % average transmitted power (dBm)
fc = 50e9; % sampling frequency
numbits =5000; % number of bits generated by the source
Ts = 10e-9; % frame time, i.e., average pulse repetition period [s]
Ns = 1; % number of pulses per bit
Tc = 1e-9; % chip time [s]
Nh = 5; % cardinality of the TH code
Np = 2000; % periodicity of the TH code
Tm = 0.5e-9; % pulse duration [s]
tau = 0.2e-9; % shaping factor for the pulse [s]
dPPM = 0.5e-9; % time shift introduced by the PPM [s]
if G_tx
% %%*********************PPM_TH发射机的仿真*********************************;
G1=0;
[bits,THcode,Stx,ref] =cp0201_transmitter_2PPM_TH(Pow,fc,numbits,Ts,Ns,Tc,Nh,Np,Tm,tau,dPPM,G1);
end
if G_channel
%假定接收机与发射机相距2m,参考路径损耗为A=47dB。
tx=1;
c0=10^(-47/20);
d=2; %传输距离2米
gamma=1.7;
[rx,ag] =cp0801_pathloss(tx,c0,d,gamma);
TMG =ag^2;
%得到信道冲激响应。
CM_Number=1;
G2=0;
[h0,hf,OT,ts,X] = cp0802_IEEEuwb(fc,TMG,CM_Number,G2);
end
if G_rx
SRX0=Stx.*ag;
numpulses=Ns*numbits;
exno=[0 3 6 9];
% exno=10;
[output,noise]=cp0801_Gnoise2(SRX0,exno,numpulses);
SRX =conv(Stx,hf);
SRX =SRX(1:length(Stx));
RX(1,:) =SRX+noise(1,:);
RX(2,:) =SRX+noise(2,:);
RX(3,:) =SRX+noise(3,:);
RX(4,:) =SRX+noise(4,:);
% tmax = numbits*Ns*Ts;
% time = linspace(0,tmax,length(Stx));
% plot(time,RX(1,:));
% grid;
L=5;
S=5;
[G,T,NF,rec_A,rec_B,rec_D]=cp0803_rakeselector(hf,fc,ts,L,S);
L=2;
S=2;
[G,T,NF,rec_A,rec_C,rec_E]=cp0803_rakeselector(hf,fc,ts,L,S);
% dPPM=0.5e-9;
[mask_A]=cp0803_ppmcorrmask_R(ref,fc,numpulses,dPPM,rec_A);
[mask_B]=cp0803_ppmcorrmask_R(ref,fc,numpulses,dPPM,rec_B);
[mask_C]=cp0803_ppmcorrmask_R(ref,fc,numpulses,dPPM,rec_C);
[mask_D]=cp0803_ppmcorrmask_R(ref,fc,numpulses,dPPM,rec_D);
[mask_E]=cp0803_ppmcorrmask_R(ref,fc,numpulses,dPPM,rec_E);
% numbit=2000;
% Ns=1;
% Ts=60e-9;
%
[RXbits,ABER] = cp0801_PPMreceiver(RX,mask_A,fc,bits,numbits,Ns,Ts);
[RXbits,BBER] = cp0801_PPMreceiver(RX,mask_B,fc,bits,numbits,Ns,Ts);
[RXbits,CBER] = cp0801_PPMreceiver(RX,mask_C,fc,bits,numbits,Ns,Ts);
[RXbits,DBER] = cp0801_PPMreceiver(RX,mask_D,fc,bits,numbits,Ns,Ts);
[RXbits,EBER] = cp0801_PPMreceiver(RX,mask_E,fc,bits,numbits,Ns,Ts);
figure(10);
semilogy(exno,ABER,'b-o',exno,BBER,'g-*',exno,CBER,'r-d',exno,DBER,'c-+',exno,EBER,'y-s');
legend('理想RAKE','选择性RAKE(5个支路)','选择性RAKE(2个支路)','部分RAKE(5个支路)','部分RAKE(2个支路)');
xlabel('Ex/N0/dB');
ylabel('Prb');
title('MRC合并RAKE性能仿真');
grid;
end
toc;
ABER
BBER
CBER
DBER
EBER
save mydata.m ABER BBER CBER DBER EBER -ascii -APPEND
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -