📄 monocycle1.m
字号:
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
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 + -