The shift theorem says:

Multiplying $x_n$ by a linear phase $e^{\frac{2\pi i}{N}n m}$ for some integer m corresponds to a circular shift of the output $X_k$: $X_k$ is replaced by $X_{k-m}$, where the subscript is interpreted modulo N (i.e., periodically).

Ok, that works fine:

plot a

arbitrary 9-sample signal

N = 9
k = [0, 1, 2, 3, 4, 5, 6, 7, 8]
plot ifft(fft(a)*exp(-1j*2*pi*3*k/N))

signal shifted by 3 samples in the frequency domain

It shifted by 3 samples, as I expected.

I thought you could also do this to shift by fractions of a sample, but when I try it, my signal becomes imaginary and not at all like the original:

plot real(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N)))
plot imag(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N))), 'b--'

signal after multiplying by 3.5 complex exponential

I didn't expect this at all. Isn't this equivalent to convolving with a real impulse that's been shifted by 3.5 samples? So the impulse should still be real, and the result should still be real? And it should have more or less the same shape as the original, but sinc interpolated?


If you want the shifted output of the IFFT to be real, the phase twist/rotation in the frequency domain has to be conjugate symmetric, as well as the data. This can be accomplished by adding an appropriate offset to your complex exp()'s exponent, for the given phase slope, so that the phase of the upper (or negative) half, modulo 2 Pi, mirrors the lower half in the FFT aperture. The complex exponential shift function can also be made conjugate symmetric by indexing it from -N/2 to N/2 with a phase of zero at index 0.

It just so happens that the appropriate offset for phase twists or spirals, that complete an exact integer multiples of 2 Pi rotations in aperture, to be conjugate symmetric in aperture, is zero.

With a conjugate symmetric phase twist vector, the result should then end up as a circular Sinc interpolation for non-integer shifts.

Elaboration by OP:

Your choice of k = [0, 1, 2, 3, 4, 5, 6, 7, 8] is producing an asymmetrical complex exponential:

asymmetrical complex exponential 0.5 sample shift attempt, with imaginary part as dashed line

If you use k = [0, 1, 2, 3, 4, -4, -3, -2, -1] instead, you get a Hermite-symmetric complex exponential:

plot(fftshift(exp(-1j * 2*pi * 0.5/N * k)))

Hermite-symmetric complex exponential for 0.5 sample shift, with imaginary part as dashed line

and now when you use the same exponential formula to shift by 0.5 or 3.5 samples, you get a real result:

plot ifft(fft(a)*exp(-1j * 2 * pi * 0.5/N *k))
plot ifft(fft(a)*exp(-1j * 2 * pi * 3.5/N *k))

shift by 0.5 and 3.5 samples, with original as dotted line

| improve this answer | |
  • $\begingroup$ Aha! Instead of k = [0, 1, 2, 3, 4], I should be using k = [0, 1, 2, -2, -1] $\endgroup$ – endolith Aug 9 '13 at 13:33
  • $\begingroup$ @endolith / hotpaw2, In other words it is all about the indexing of the time-domain samples? $\endgroup$ – TheGrapeBeyond Aug 9 '13 at 14:58
  • 1
    $\begingroup$ Symmetry around bin 0 will also provide symmetry around N/2, even if N/2 isn't an integer. $\endgroup$ – hotpaw2 Aug 5 '15 at 20:19
  • 1
    $\begingroup$ I found a function that applies the correct modulation on Matlab File Exchange: mathworks.com/matlabcentral/fileexchange/7886-fshift 👏! $\endgroup$ – Ahmed Fasih Aug 6 '15 at 15:39
  • 1
    $\begingroup$ does this equally hold for complex signals? $\endgroup$ – Leo Aug 24 '17 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.