% ===========LSD对源文件的整理版本===========
% ======缩写 & 简称======
% UWB 超宽带 BPSK 二进制相移键控(模数转换,A→D)
% AWGN 加性高斯白噪声 p 默认为pulse
% pw 脉冲宽度 doublet 脉冲对(极性未知)
% ======阶段1:参数预设 =====阶段1
for fold_stage=1:1
% ======初始化常数======
A=1; % 原文件并没有给出A,推测为AMPLITUDE,或者类似归一化常数,此时设为1
pw1=.2e-9; % 脉冲宽度(纳秒),可根据需要调整
pw=pw1/1.24; % 不准确脉冲宽度的调整系数(1阶约为3-5。第二级约为1-3。)
Fs=100e9; % 抽样频率
Fn=Fs/2; % 奈奎斯特频率
t=-1e-9:1/Fs:30e-9; % 以Fs赫兹采样的时间矢量。用于放大/缩小(-1e-9:1/fs:XXXX)
% ======公式 & 方程======
jieshu=3;
if jieshu==1
y=A*(t/pw).*exp(-(t/pw).^2); % 高斯脉冲的一阶导数=高斯单周期
else
y =1*(1 - 4*pi.*((t)/pw).^2).* exp(-2*pi.*((t)/pw).^2); % 高斯二阶导数
end
% LSD修改2:将2阶导数改为n阶:diffi_count的起始恒为3
for diffi_count=3:jieshu
for i=1:3100 % 微分后长度减一,这里没有调整,可能是隐患
y(i)=Fs*(y(i+1)-y(i));
end
end
%pulse=doublet(two zero crossings) % 脉冲为脉冲对(过零点两次)
% ======噪声设置:调整误码率和信噪比======
% LSD改动1:去除噪声;原函数为源代码中的噪声函数,因实验需要,替代为无噪声
% noise=(1e-50)*(randn(size(t))); % 噪声——加性高斯白噪声(参数为0.2时,信噪比约为7分贝)
noise = 0;
%对于峰峰值为2伏特的BPSK信号。设置为1e-50以禁用
end
% =====阶段2:BPSK 模数转换 =====阶段2
for fold_stage=2:2
% =====一阶导数单循环(百万分之5脉冲)
% yp=y+ ...
% A*((t-2.5e-9-.2e-9)/pw).*exp(-((t-2.5e-9-.2e-9)/pw).^2)+A*((t-5e-9)/pw).*exp(-((t-5e-9)/pw).^2)+ ...
% A*((t-7.5e-9-.2e-9)/pw).*exp(-((t-7.5e-9-.2e-9)/pw).^2)+A*((t-10e-9)/pw).*exp(-((t-10e-9)/pw).^2);
% =====二阶导数双峰(5脉冲BPSK)
%BPSK调制后脉冲对(YP)
yp=1*y+ ...
-1*(1-4*pi.*((t-6.41e-9)/pw).^2).*exp(-2*pi.*((t-6.41e-9)/pw).^2)+ ...
1*(1-4*pi.*((t-12.82e-9)/pw).^2).*exp(-2*pi.*((t-12.82e-9)/pw).^2)+ ...
-1*(1-4*pi.*((t-19.23e-9)/pw).^2).*exp(-2*pi.*((t-19.23e-9)/pw).^2)+ ...
1*(1-4*pi.*((t-25.64e-9)/pw).^2).*exp(-2*pi.*((t-25.64e-9)/pw).^2);
%未调制脉冲对(yum)
B=1;
yum=B*y+ ...
B*(1-4*pi.*((t-6.41e-9)/pw).^2).*exp(-2*pi.*((t-6.41e-9)/pw).^2)+ ...
B*(1-4*pi.*((t-12.82e-9)/pw).^2).*exp(-2*pi.*((t-12.82e-9)/pw).^2)+ ...
B*(1-4*pi.*((t-19.23e-9)/pw).^2).*exp(-2*pi.*((t-19.23e-9)/pw).^2)+ ...
B*(1-4*pi.*((t-25.64e-9)/pw).^2).*exp(-2*pi.*((t-25.64e-9)/pw).^2);
ym=yp+noise; %BPSK调制有噪脉冲对
yc=ym.*yum; %yc(相关输出)= ym(调制后)乘以yum(未调制)双峰。
% 这里是接收器中,进行互相关运算的地方,也就是接收器中的混频器。
% =====傅里叶变换,求频谱
% 对“BPSK转换后的脉冲对”进行傅里叶变换
NFFYM=2.^(ceil(log(length(ym))/log(2)));
FFTYM=fft(ym,NFFYM); %序列末端补0
NumUniquePts=ceil((NFFYM+1)/2);
FFTYM=FFTYM(1:NumUniquePts);
MYM=abs(FFTYM);
MYM=MYM*2;
MYM(1)=MYM(1)/2;
MYM(length(MYM))=MYM(length(MYM))/2;
MYM=MYM/length(ym);
f=(0:NumUniquePts-1)*2*Fn/NFFYM;
% 对“未调制脉冲对(yum)”进行傅里叶变换
NFFYUM=2.^(ceil(log(length(yum))/log(2)));
FFTYUM=fft(yum,NFFYUM);%pad with zeros
NumUniquePts=ceil((NFFYUM+1)/2);
FFTYUM=FFTYUM(1:NumUniquePts);
MYUM=abs(FFTYUM);
MYUM=MYUM*2;
MYUM(1)=MYUM(1)/2;
MYUM(length(MYUM))=MYUM(length(MYUM))/2;
MYUM=MYUM/length(yum);
f=(0:NumUniquePts-1)*2*Fn/NFFYUM;
%new FFT for correlated pulses(yc)
%yc is the time domain signal output of the multiplier
%(modulated times unmodulated) in the correlation receiver. Plots
%in the time domain show that a simple comparator instead of high speed A/D's
%may be used to recover the 10101 signal depending on integrator design and level of
%peak voltage into mixer.
NFFYC=2.^(ceil(log(length(yc))/log(2)));
FFTYC=fft(yc,NFFYC);%pad with zeros
NumUniquePts=ceil((NFFYC+1)/2);
FFTYC=FFTYC(1:NumUniquePts);
MYC=abs(FFTYC);
MYC=MYC*2;
MYC(1)=MYC(1)/2;
MYC(length(MYC))=MYC(length(MYC))/2;
MYC=MYC/length(yc);
f=(0:NumUniquePts-1)*2*Fn/NFFYC;
end
% =====阶段3:作图(plot) =====阶段3
for fold_stage=3:3
%plots for modulated doublet(ym)
figure(1)
subplot(1,2,1); plot(t,ym);xlabel('TIME');ylabel('AMPLITUDE');
title('Modulated pulse train');
grid on;
%axis([-1e-9,27e-9 -1 2])
% subplot(1,2,2); plot(f,MYM);xlabel('FREQUENCY');ylabel('AMPLITUDE');
% %axis([0 10e9 0 .1]);%zoom in/out
% grid on;
subplot(1,2,2); plot(f,log10(MYM)-50);xlabel('FREQUENCY');ylabel('20LOG10=dBm');
%axis([0 20e9 -120 0]);
grid on;
% %plots for unmodulated doublet(yum)
% figure(2)
% subplot(2,2,1); plot(t,yum);xlabel('TIME');ylabel('AMPLITUDE');
% title('Unmodulated pulse train');
% grid on;
% axis([-1e-9,27e-9 -1 1])
% subplot(2,2,2); plot(f,MYUM);xlabel('FREQUENCY');ylabel('AMPLITUDE');
% axis([0 10e9 0 .1]);%zoom in/out
% grid on;
% subplot(2,2,3); plot(f,20*log10(MYUM));xlabel('FREQUENCY');ylabel('20LOG10=DB');
% %axis([0 20e9 -120 0]);
% grid on;
%plots for correlated pulses(yc)
% figure(3)
% subplot(2,2,1); plot(t,yc);xlabel('TIME');ylabel('AMPLITUDE');
% title('Receiver correlator output-no LPF');
% grid on;
% %axis([-1e-9,27e-9 -1 1])
% subplot(2,2,2); plot(f,MYC);xlabel('FREQUENCY');ylabel('AMPLITUDE');
% %axis([0 7e9 0 .025]);%zoom in/out
% grid on;
% subplot(2,2,3); plot(f,20*log10(MYC));xlabel('FREQUENCY');ylabel('20LOG10=DB');
% %axis([0 20e9 -120 0]);
% grid on;
% %===========================================================
% %CORRELATION RECEIVER COMPARATOR(before lowpass filter)
% %===========================================================
% pt=.5%sets level where threshhold device comparator triggers
% H=5;%(volts)
% L=0;%(volts)
% LEN=length(yc);
% for ii=1:LEN;
% if yc(ii)>=pt;%correlated output(y2) going above pt threshold setting
% pv(ii)=H;%pulse voltage
% else;
% pv(ii)=L;
% end;
% end ;
% po=pv;%pulse out=pulse voltage
%
% subplot(2,2,4);
% plot(t,po);
% axis([-1e-9 27e-9 -1 6])
% title('Comparator output');
% xlabel('Frequency');
% ylabel('Voltage');
% grid on;
end
% =====阶段4:相关接收机低通滤波器(积分器) =====阶段4
for fold_stage=4:0
rc=.2e-9;%time constant
ht=(1/rc).*exp(-t/rc);%impulse response
ht=.2e-9*ht;%I'm not sure about this.Reduces integrated output voltage greatly.
ycfo=filter(yc,1,ht)/Fs;%use this instead of ycfo=conv(yc,ht)/Fs for proper dimension.
%The #=1 allows this. The LPF RC time constant(integrates over this time).
%Theory states that it should be set to the pulse width but should be set
%to a value that gives the best error free operation at the highest noise
%levels. Different filter types(butterworth,etc) may give different
%results.I don't have the butter function.
%The 3DB or 1/2 power bandwidth on the RC LPF is f=1/(2*pi*RC). The noise
%bandwith is f=1/(4*rc).
yn=filter(noise,1,ht)/Fs;%looks at filtered noise only(Figure 5)
%new FFT for filtered correlated pulses(ycfo)
NFFYCFO=2.^(ceil(log(length(ycfo))/log(2)));
FFTYCFO=fft(ycfo,NFFYCFO);%pad with zeros
NumUniquePts=ceil((NFFYCFO+1)/2);
FFTYCFO=FFTYCFO(1:NumUniquePts);
uwb.zip_FCC_OFDM QPSK_UWB系统_dpsk_uwb
版权申诉
123 浏览量
2022-09-24
10:36:22
上传
评论 1
收藏 6KB ZIP 举报
朱moyimi
- 粉丝: 61
- 资源: 1万+