?? main.asv
字號:
%IR-UWB MRC合并RAKE性能仿真
function
clc;
clear all;
tic;%clock
G_tx=1;%發(fā)射機仿真開關
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發(fā)射機的仿真*********************************;
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
%假定接收機與發(fā)射機相距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 + -