IFFT, resampling, complex conjugate symmetry, zero padding, interpolation, aliasing, oscillation

3 Ansichten (letzte 30 Tage)
Hello, I have measurements (complex values) in the frequency domain, from 20 MHz to 20 GHz. I would like to convert them into time domain using IFFT. My Data has three columns, the first column is frequency (20000000, 32487500, 44975000, ...,2e10), 1601 points and the second and third columns are corresponding real and imaginary data. Size of matrix is (1601 x 3)
Here is my code.
%% uniform sampling in time domain
OT = 1./Data_mix(:,1); % original time
OF = Data_mix(:,1); % original Frequency
NT = flipud(linspace(OT(end,1), OT(1,1), 1000)'); % new time in uniform spacing
NT = [NT; 0]; % 1001 x 1
T = NT(2)-NT(3); % dt, 1.952e-12
FS = 1/T; % need to be at least twice the maximum frequency ?
N = size(NT,1); % 1001
df = FS/N; % Frequency increment
f = [0 : df : FS-df]'; % 1001 x 1
c_ust = 1;
Data_R = interp1(OF, Data_mix(:,2), f,'nearest','extrap'); % real
Data_I = interp1(OF, Data_mix(:,3), f,'nearest','extrap'); % imag
Data_ust = Data_R + 1j*Data_I; % Data with uniform sampling time 1001
%% making complex conjugate symmetry
Data_cc = [real(Data_ust(1,1)); Data_ust(2:end-1,1); real(Data_ust(end,1)); conj(Data_ust(end-1:-1:2,1))]; % complex conjugate symmetric data
%% interpolation in time domain
IF = 16; % interpolation factor (2, 4, 8, 16, or 32...)
Ncc = 2*N-2; % 2000
fcc = df*(0:Ncc-1)'; % frequency points
MM = IF*Ncc; % interpolation factor
dt1 = T/MM;
t1 = dt1*(0:MM-1)'; % time points after interpolation 2000 * 16 = 32000
f1 = df*(0:MM-1)'; % frequency points after interpolation 2000 * 16 = 32000
%% zero-paddings
if mod(Ncc,2)==0 % N even
Data_zp = [Data_cc(1:Ncc/2,1); 0.5*Data_cc(1+Ncc/2,1); zeros(MM-Ncc-1,1);
0.5*Data_cc(1+Ncc/2,1); Data_cc(2+Ncc/2:Ncc,1)];
else % N odd
Data_zp = [Data_cc(1:(Ncc+1)/2,1); zeros(MM-Ncc,1); Data_cc((Ncc+3)/2:Ncc,1)];
end
%% IFFT
Data_TD = (MM/Ncc)*ifft(Data_zp);
figure, plot(t1, Data_TD,'o-'); grid on; xlim([0 5e-13]);
The result shows like this, which has unwanted oscillation. Please teach me what is wrong. Thank you!
  3 Kommentare
Hyungjoo Lee
Hyungjoo Lee am 17 Mai 2017
Dear Santhana, Thank you for your thoughtful answer.
Original Frequency (OF, raw measurements, 1601 points) has uniform spacing (20000000, 32487500, 4497500, 57462500, ..., 19988e10, 2e10) so df is 12487500 Hz. This means Original Time (OT = 1./OF) has non-uniform spacing as (5e-8, 3.0781e-8, 2.2235,-8, ..., 5.0031e-11, 5e-11 sec) and dt is not a constant. Thus, I made a new time (NT, 1001 points) using linspace as (5e-8, 4.995e-8, 4.99e-8, ..., 1e-10, 5e-11, 0) with dt is 5e-11 (dt=1.952e-12 was a typo, sorry). So, my FS was FS = 1/dt = 1/5e-11 = 2e10 [Hz].
Now, you suggested that FS should be (Data_mix(1,1)-Data_mix(2,1))*1601 = (20000000 - 32487500)*1601 = -1.9992e10 (or + 1.9992e10). I've tried but it does not fix my problem.
For the no of points in the IFFT, the N is (8000) because
OT = 1601 (original raw measurement points)
NT = 1001 (uniform sampling)
Ncc = 2000 (complex conjugate symmetry)
Nzp = 8000 (interpolation factor, IF = 4, Nzp = IF*Ncc)
So do you think I should use FS as dt*Nzp = 5e-11*8000 = 4e-7 [s] ? If I change FS, then df, f, Data_ust, Data_cc, and Data_zp will change correspondingly. Also, I still have those unwanted oscillations. Please advise.
Thank you.
Hyungjoo Lee
Hyungjoo Lee am 1 Jun. 2017
I found that the reason of the oscillation was due to my measurements, which are not periodic functions, Thank you.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by