📄 uwb_monocycle1.m
字号:
%UWB_MONOCYCLE1-Run from editor debug(F5)
%This m file plots the time and frequency waveforms for the 1st and 2nd derivative
%equations used in UWB system analysis. Fudge factors are required to
%correct for inaccuracies in the 1st and 2nd derivative equations.
%Tail to tail on the time wave forms must be considered as the actual pulse width.
%7*PW1 has about 99.9% of the signal power. The frequency spreads and center
%frequencies(fc=center of the spread)are basically correct as you can verify(fc~1/pw1).
%Change t and fudge factor for other pulse widths and zooming in on the time waveforms.
%Signal available to test FFT.Another signal is available for notching the frequency spread
%which could be future direction for adaptive UWB systems or could be used for basic multipath
%and interference analysis depending on what equation is used.
pw1=.25e-9;%pulse width in nanosec,change to desired width
pw=pw1/4.5;%Fudge factor for inaccurate PWs,4-5 for 1st der. and 2-3 for 2nd der.
Fs=20e9;%sample frequency
Fn=Fs/2;%Nyquist freq
t=-3e-9:1/Fs:3e-9;%time vector sampled at Fs hertz
td=0;%time delay-PPM(pulse position modulation) with td=0 a zero bit and td>0=1 bit
A=1;%PAM(pulse amplitude modulation) with A=1 a zero bit and A>1=1 bit
%Phase=+/-180 degrees BPSK-not sure how to do this. Need to put for loops in for
%many pulses and rates for all three types of modulation
x =((t-td)/pw).^2;
%y=A.*exp(0.5.*(-x));%Gaussian pulse function
y=A*(t/pw).*exp(-x);%1st derivative Gaussian pulse=Gaussian monocycle
%y =A*(1 - 4*pi.* x).* exp(-2*pi.* x);%2nd derivative Gaussian pulse=doublet(two zero crossings)
%y=sin(2*pi.*t*2e9);%test signal only-%out 1st and 2nd derivative signals
%y=y.*sin((2*pi*t*2.e9).^2);%provides spectrum notches for adaptive schemes
figure(1)
plot(t,y)%time domain
title('Time domain');
xlabel('nanoseconds');ylabel('amplitude')
grid on
NFFY=2.^(ceil(log(length(y))/log(2)));
FFTY=fft(y,NFFY);%pad with zeros
NumUniquePts=ceil((NFFY+1)/2);
FFTY=FFTY(1:NumUniquePts);
MY=abs(FFTY);
MY=MY*2;
MY(1)=MY(1)/2;
MY(length(MY))=MY(length(MY))/2;
MY=MY/length(y);
f=(0:NumUniquePts-1)*2*Fn/NFFY;
figure(2)
plot(f,MY);
%plot(f,20*log10(MX));%frequency domain
title('frequency domain')
xlabel('Frequency');ylabel('Amplitude')
%axis([0 .1e9 -60 0])%zoom in
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -