MATLAB ifft time shift problem

3 views (last 30 days)
Quinten VdB
Quinten VdB on 19 Oct 2016
Answered: Sk Group on 27 Oct 2021
Hi there, Recently i encountered some problems when using the ifft function. The time shift property of a fourier transform is as folows:
f(t-t0) <-> F(f)*exp(-j*f*t0)
However, when doing an ifft on the right side function (in frequency domain), the time domain signal shifts to the right (in stead of shifting to the left). The formulas on fft help page (section 'More About') are the same formulas I used to derive this time shift property. The ifft page doesn't specify any information about used formulas.
Can anybody tell me if they encountered similar problems? Currently I've solved the problem by replacing the exp(-j*f*t0) by exp(j*f*t0), but I would like to get a good explanation of why this solution works.
Thanks for your time!

Answers (2)

Star Strider
Star Strider on 19 Oct 2016
You didn’t show your calculation for the Fourier transform. If you used ‘+j’ for the Fourier transform, use ‘-j’ for the inverse transform. The signs themselves don’t matter, so long as the sign for the ‘forward’ transform is the negative of the sign for the ‘inverse’ transform.
  2 Comments
Quinten VdB
Quinten VdB on 19 Oct 2016
I didn't really calculate a Fourier transform, I just imported some simulation results in the frequency domain, which I then (after some additional operations) try to transform to time domain using the ifft() function of MATLAB.
The problem is actually with the sign of the exponential term, causing a shift to the left/right in the time domain.
Here is my code:
overlap_freq = tf_freqs(ff_start(2)):wish_df:tf_freqs(ff_stop(2));
tf_ff = S21(ff_start(2):ff_stop(2))/2 ./ ...
(exp(-1i*2*pi.*overlap_freq./cst_C0.*cst_dist) ./ cst_dist)' ./ ... Changed -1i*... to 1i*... (MATLAB shifts to right with exp(i*f) instead of to left)
(-2.*1i.*cst_C0./overlap_freq./cst_Z_c)' ./ ...
(cst_Z_L ./ (cst_Z_L+Z_R(ff_start(2):ff_stop(2)))) ./ ...
HORN_E_pattern(ff_start(3):ff_stop(3))';
ff_y2_f = in_y1_fft(ff_start(1):ff_stop(1)).*tf_ff;
ff_y2_f = [zeros(ff_start(1),1); ff_y2_f];
% ---------------------------------------------------------------------
% Add zero padding to get same time domain resolution as input signal
wish_dt = in_dt;
wish_Fs = 1/wish_dt;
wish_N_t = round(wish_Fs/wish_df);
wish_add_t = round(wish_N_t/2) - length(ff_y2_f); % wish_N_t / 2 because of only half of the spectrum is given with S-parameters
ff_y2_f = [ff_y2_f; zeros(wish_add_t,1)];
% ---------------------------------------------------------------------
% Calculate time domain pulse
ff_y2_f = [ff_y2_f; conj(flipud(ff_y2_f(1:end-1)))];
ff_y2 = ifft(ff_y2_f);
So in the top statement (tf_ff = ...) I divide by an exponential of the form exp(-j*f*t0), which is the same as multiplying by exp(j*f*t0). As such a shift to the left would be expected in the time domain. However, when plotting the result, the signal has shifted to the right.
Star Strider
Star Strider on 19 Oct 2016
That may depend on how the transform was originally calculated. I would just go with what works and be happy with the result.

Sign in to comment.


Sk Group
Sk Group on 27 Oct 2021

Community Treasure Hunt

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

Start Hunting!