Pulse Train FFT low resolution

2 vues (au cours des 30 derniers jours)
Ata Sarrafi
Ata Sarrafi le 2 Déc 2017
Commenté : Ata Sarrafi le 4 Déc 2017
Hi,
I have written a code for pulse train and its FFT. However, my FFT resolution is bad. How can I make this better ?
fs=1e9 ; %sampling frequency
t=-0.1e-6:1/fs:7e-6; %time base
T=1e-6; %Period
D=0.5e-6 %Duration
N=40; %Number of pulses
d=[0: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 = 1024;
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)|');
  1 commentaire
Ata Sarrafi
Ata Sarrafi le 3 Déc 2017
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.

Connectez-vous pour commenter.

Réponse acceptée

Akira Agata
Akira Agata le 2 Déc 2017
Modifié(e) : Akira Agata le 2 Déc 2017
When using FFT, you should consider about "periodic boundary condition." In your original code, I don't think this condition was satisfied.
If my understanding is correct, your waveform in time domain repeats every 1000 samples. And if you want to obtain more frequency resolution, you should increase FFT length. So, based on your original code, you should change "NFFT = 7000;"
To enhance the performance, I would recommend adjusting sampling frequency to match the FFT length (NFFT) to 2^N.
  5 commentaires
Akira Agata
Akira Agata le 4 Déc 2017
OK. The sinc function in frequency domain is a Fourier transform of singe rectangle pulse. The following is an example.
To understand the relationship between rectangular pulse train and sinc function in detail, please refer to a textbook of digital communication theory.
% Fixed parameters
T = 1e-6; %Period
D = 0.5e-6; %Duration
N = 10; %Number of pulses
tw = T*N; % Time window
% Adjust fs to make Nfft = 2^14
Nfft = 2^13;
fs = Nfft/tw; % Sampling frequency
% Generate single pulse
t = -(tw/2):(1/fs):(tw/2)-(1/fs);
y = rectpuls(t,D);
% FFT
X = fftshift(fft(y));
f = fs*(-Nfft/2:Nfft/2-1)/Nfft; %Frequency Vector
% Show the result
figure
subplot(2,1,1)
plot(t,y)
title(['Rectangular Pulse width = ', num2str(D),' [s]'])
xlabel('Time [s]')
ylabel('Amplitude')
subplot(2,1,2)
plot(f,abs(X)/Nfft,'r')
title('Magnitude of FFT')
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|')
xlim([-30e6 30e6])
Ata Sarrafi
Ata Sarrafi le 4 Déc 2017
Thank you but I already know this and plotted this FFT before. I am not checking only 1 pulse. As I mentioned before I want to observe it for pulse train not only 1 pulse. It is going to be sinc as well.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by