📄 fsruwbtx.m
字号:
% TR-UWB Transmitter
% Author: Caglar Arslan
% Date: 30-09-2007 (1st Version)
% 02-10-2007 (Revised)
% 03-10-2007 (Finalized)
%--------------------------------------------------------------------------
% Simulation Experiment Parameters
% fs : Sampling frequency of the pulses
% Ep : Used for adjusting the energy of the pulse
% tc : Width of the pulse
% Tf : Frame length reference (A Real Number)
% Nf : Pulse Repetition Info
% Td : Data pulse delay reference
% Nc : TH Code bin number reference. Usually taken as Nc=Tf
% AWGNSNR : SNR value for AWGN (in dB)
% GaussianPulseOrder : Determines the shape of the pulse (2 for 2nd order,
% 3 for 3rd order)
% plotFlag : Logical flag for the plot of the pulse shape and the
% transmitted signal. Disable this for large number of bits for
% transmission.
% Sample Experiment:
% numberOfBits=50;
% fs=50e9;
% Ep=1;
% tc=1e-9;
% Tf=10;
% Nf=2;
% Td=2;
% Nc=Tf;
% AWGNSNR=10;
% [allPulsesWithNoise SimulationTime DataSequence THCode] = TRUWBTXfinal(numberOfBits,fs,Ep,tc,Tf,Nf,Td,Nc,AWGNSNR,3,0);
function [allPulses SimulationTime DataSequence THCode] = FSRUWBTX(numberOfBits,fs,Ep,tc,Tf,Nf,Nc,GaussianPulseOrder,plotFlag);
% The Pulse Shape
if GaussianPulseOrder==3
% Gaussian Pulse Monocycle 2nd Order
% 2 GHz Gaussian monopulse sampled at a rate of 100 GHz:
fc = 2E9; fs=100E9; % center freq, sample freq
tc = gmonopuls('cutoff',fc); % width of each pulse
t1 = -2*tc : 1/fs : 2*tc;
Y = gmonopuls(t1,fc);
end
% Gaussian Pulse 3rd Order
if GaussianPulseOrder==2
t=-5e-10:1/fs:5e-10;
a=tc /2.5;
Y=(1-(4*pi.*(t.^2))/a^2) .* exp(-2*pi.*(t.^2)/a^2) / sqrt(Ep);
end
if plotFlag==1
figure
plot(t,Y) %Plot of Gaussian Monocycle Pulse - 2nd Order Gaussian Pulse
end
%--------------------------------------------------------------------------
Ts=Nf*Tf;
fo=1/(Ts*1e-9);
rand1=randperm(Nc); rand2=randperm(Nc);
myRand=rand1(rand2(1));
% Generate the Reference Locations
D1(1)=myRand -0.5; %Location of the first TR pulse
THCode(1)=myRand;
for i=2:numberOfBits
rand1=randperm(Nc); rand2=randperm(Nc);
myRand=rand1(rand2(1));
THCode(i)=myRand;
D1(i)=D1(i-1)+(Ts*(i-1)-D1(i-1)-tc)+ myRand;
end
if (Nf>0)
k=1;
for i=1:length(D1)
for j=0:(Nf-1)
newD1(k)=D1(i)+Tf*j;
k=k+1;
end
end
end
D1=newD1;
Dtr = D1' * 1e-9; % locations of the TR pulses in ns.
% Generate the TR Pulse Train
t = 0 : 1/fs : numberOfBits*Ts*1e-9; % signal evaluation time
SimulationTime=t;
yp = pulstran(t,Dtr,Y*sqrt(Ep/2),fs);
% Generate the Modulation Info and Data Pulses
randOut=randint;
if randOut==1
modulationInfo=1;
else
modulationInfo=-1;
end
DataSequence(1:numberOfBits)=modulationInfo;
ypx=pulstran(t,Dtr,Y*modulationInfo*sqrt(Ep),fs);
% Mixer the Data Pulse and Sum with Reference pulses
mixerTerm=cos(2*pi*fo*SimulationTime);
ypxNew=ypx.*mixerTerm;
allPulses=yp+ypxNew;
%--------------------- END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -