Pulse Train FFT low resolution

조회 수: 22 (최근 30일)
Ata Sarrafi
Ata Sarrafi 2017년 12월 2일
댓글: Ata Sarrafi 2017년 12월 4일
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
Ata Sarrafi
Ata Sarrafi 2017년 12월 3일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Akira Agata
Akira Agata 2017년 12월 2일
편집: Akira Agata 2017년 12월 2일
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
Akira Agata
Akira Agata 2017년 12월 4일
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 2017년 12월 4일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by