How do I perform a proper FFT of a gated segment of a time domain waveform with a logmag amplitude?

70 views (last 30 days)
I have frequency domain data in I/Q to start. I can successfully transform with IFFT to a logmag time domain waveform of 4499 points. The freq domain data is 512 points with freq step of 10.9375Mhz (5.6Ghz of BW). The waveform is 0-91.25nS in length. After IFFT using a Matlab script in other software, I gate a section out for further processing. This is usually around 51 points and 1nS in length. I'm trying to take this gated waveform and FFT back to freq domain with proper amplitudes and frequency. I'm new to data processing and especially Matlab so need help.
Should FFT be same number of points as IFFT? How do I ensure proper frequency distribution with only a 51 point waveform?
Thanks for any help...
  9 Comments
Paul
Paul 33 minutes ago
If X is the 512-point data in the frequency domain, then doing
ifft(X,4499)
is not correct. In the frequency domain, the input to ifft has to be zero-padded in the middle of the array to return an interpolated signal in the time domain.
I'll come back later with a concrete example.
In the meantime, see if this Answer provides any insight.
Todd
Todd 12 minutes ago
I think you are correct if you want to track phase. If magnitude is your only concern, trail end padding is sufficient.
I'm no expert, so verify this or correct me I'm wrong.
Your other answer (link you sent) was VERY informative. Thanks so much!

Sign in to comment.

Accepted Answer

Paul
Paul about 12 hours ago
Generate a 512-point reference signal in the time domain
Ts0 = 0.01;
Fs0 = 1/Ts0;
N0 = 512;
n0 = 0:N0-1;
t0 = n0*Ts0;
y0 = sin(2*pi*10*t0);
512-point FFT and the assoicated frequency vector; plot the magnitude; peaks are at expecte locations
Y0 = fft(y0);
f0 = n0/N0*Fs0;
figure
plot(f0,abs(Y0))
xline([10,Fs0-10],'r')
Zero-pad the FFT to 4500 points. I think we want to ensure that the number point zeros in the padding is even to maintain conjugate symmetry.
N1 = 4500;
npad = (N1 - N0)/2;
Zero-pad in the middle of the array. We can accomplish this by fftshift-ing the the transform, zero-pad with the same number of points on each side, and ifftshift back
Y1 = ifftshift([zeros(1,npad),fftshift(Y0),zeros(1,npad)]);
Two extra steps needed to ensure the zero-padded transform is conjugate symmetric
Y1(2 + N0/2 - 1) = Y1(end - N0/2 + 1)/2;
Y1(end - N0/2 + 1) = Y1(2 + N0/2 - 1);
isequal(Y1(2:end),conj(Y1(end:-1:2)))
ans = logical
1
The associated sampling frequency is scaled from the original after the padding
Fs1 = Fs0*N1/N0;
n1 = 0:N1-1;
f1 = n1/N1*Fs1;
Peaks are in the expected locations
figure
plot(f1,abs(Y1))
xline([10,Fs1-10],'r')
Back to the time domain from the the padded transform. Scale the output to account for padded transform, which wasn't itself rescaled
y1 = ifft(Y1,'symmetric')*N1/N0;
Ts1 = 1/Fs1;
t1 = n1*Ts1;
The resulting signal interpolates the original signal
figure
plot(t0,y0,'o',t1,y1,'-'),grid
Take 51 points from the interpolated time domain signal
N2 = 51;
y2 = y1(1:N2);
n2 = 0:N2-1;
Ts2 = Ts1;
figure
plot(n2*Ts2,y2)
Those points don't even cover a full cycle
Fs2 = Fs1;
Transform and plot
Y2 = fft(y2);
f2 = n2/N2*Fs2;
figure
plot(f2,abs(Y2)),grid
xline([10,Fs2-10],'r')
Do the same with more points, peaks in the expected locations
N2 = 251;
y2 = y1(1:N2);
n2 = 0:N2-1;
Y2 = fft(y2);
f2 = n2/N2*Fs2;
figure
plot(f2,abs(Y2)),grid
xline([10,Fs2-10],'r')

More Answers (0)

Products


Release

R2011a

Community Treasure Hunt

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

Start Hunting!