it does not work
f
s=1.17e9 ; %sampling frequency
t=0:1/fs:7e-6; %time base
T=1e-6; %Period
D=0.5e-6 %Duration
N=80; %Number of pulses
d=[-70e-6:T:T*N];
y=pulstran(t,d,'rectpuls',D);
t=t+0.25e-6;
subplot(2,1,1)
plot(t,y);
title(['Rectangular Pulse width=', num2str(T),'s']);
xlabel('Time(s)');
ylabel('Amplitude');
L=length(y);
NFFT = 8192;
X = fftshift(fft(y,NFFT)); %FFT with FFTshift for both negative & positive frequencies
f = fs*(-NFFT/2:NFFT/2-1)/NFFT; %Frequency Vector
subplot(2,1,2)
plot(f,abs(X)/(L),'r');
title('Magnitude of FFT');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');
my length is 8191 and I set NFFT=8192=2^13 resolution now is even worth.


