# Limitation on the shift theorem of DFT due to frequency resolution?

The shift theorem states that shifting a sine wave in time domain by t is equivalent to multiplying the corresponding DFT coefficient of the signal by a complex exponential e^(-jwt). Described by the following operation:

However, I realized that in order to apply the time shift precisely, the frequency of interest has to be multiples of the frequency bin size.

Here is a quick example I did in MATLAB - I simulated two signals (blue & red), red being the delayed version of the blue (with arbitrary Fs and signal length). My goal is to time shift the red signal by the delayed amount of time so that it overlaps with the blue (forget about the discontinuity caused by the circular shift property for now!!) :

In this image, the frequency of my signal (104.65Hz) is the exact multiples of my frequency bin size, therefore the shifted signal matches the original perfectly.

In this cases, the frequency of my signal (150Hz) lies in between my frequency bins. Despite the fact that 150Hz is very close to 104.65Hz, the shift is off from my desired delay amount.

Now imagine if I have a slightly more complicated signal with multiple sinusoidal components, and I would like to shift each of them by a different t. It is virtually impossible to choose my frequency bin such that it can be divided nicely by all these frequencies. What should I do in that case?

I guess I was wondering:

1. If someone can explain to me where exactly does this kind of shift offset come from.

2. If I have a more complicated signal described above and I want to shift different sinusoids by different amount, how can I get around this problem?

Many thanks!

• However, I realized that in order to apply the time shift precisely, the frequency of interest has to be multiples of the frequency bin size. Um, no, that's exactly how I do fractional-sample time shifts for large data sets: FFT->multiply by $e^{-j2\pi\tau \frac nN}$ -> IFFT. It's a circular time shift, but it's accurate. Nov 27 '18 at 0:17
• But what if I want to shift different frequency components by a different number of samples? In that case, you can't find FFT of the whole data set and multiply by the same exponential. You would have to treat different frequencies separately right? Nov 27 '18 at 0:24
• what you're describing is a system with a non-constant (i.e. frequency-dependent) group delay. Nov 27 '18 at 10:50

But what if I want to shift different frequency components by a different number of samples? In that case, you can't find FFT of the whole data set and multiply by the same exponential. You would have to treat different frequencies separately right?

What you're describing is a system with a non-constant (i.e. frequency-dependent) group delay.

Group delay is the derivative of phase, hence, $$\frac{\mathrm d\phantom f}{\mathrm df}\phi(f)$$ of a system.

In filter design, you (most of the time) want a constant group delay, so you design your filter with linear phase (which means you need to use FIR filters, and you need to make them symmetric); the derivative of a linear function is a constant!

Now, you want a given "group delay profile". Sooo, what about actually implementing the following idea:

Essentially, you approach this via the window design method that one typically uses to design linear-phase filters of a wanted amplitude response. You, instead, want a to define a group delay, and hence, a phase response over frequency.

1. Convert a definition of your group delay to a phase definition by numerically integrating that profile (i.e. do a cumulative sum). (the integration is the inverse operation to the differentiation that delivers the group delay from the phase response; so, the result should be that each value is a $$e^{j2\varphi}$$, with $$2\pi\varphi$$ being the relative delay you want). Do that definition at a high "oversampling", i.e. if you just need an actual "resolution" for your frequency-dependent delay of sampling rate / 10, define that function at 200 points. Note down that you have a "frequency-sampling-rate" of $$r_\text{freq}=\frac{f_\text{sample}}{200}$$.
2. Convolve the result with a low-pass linear filter impulse response. Why will become clearer in the next step.
3. Convert the result to time domain by doing an IDFT (IFFT). The effect of the low-pass filter above is now, a lot of the resulting values are (close enough to) zero. So, you can omit these.

If I'm not mistaken, you now have a filter of desired group delay profile plus a constant (the constant stems from the low-pass filtering in frequency domain).

Another route if you only care about non-overlapping bands and these should have very different group delays, making it hard to properly build that filter via the filter design method:

1. Find the "hardest" (i.e. narrowest) bands; design a FIR band pass filter for these using your favorite math toolkit's filter design methodology (I propose designing an equivalent-width low pass and shifting it in frequency). The length of that filter will be the longest you'll need for all the band pass filters. Sufficiently over-sample, i.e. re-design that filter, but use let's say 20 times the length. Use that length for all other filters, too.
2. The group delay of a linear-phase phase filter is half its length. Now, all your bandpasses have the same group delay $$\tau_\text{offset}$$.
3. Adjust the group delay of the individual filters by transforming (FFT), multiplying by a complex sinusoid of appropriate frequency, and transforming back (IFFT). If your frequency isn't (close enough) to $$f_s / \text{length}(filter)$$, you'll get leakage / Gibb's phenomenon. You can trade accuracy for oscillations by applying a window. If your filters are long, it's probably not even necessary to window.
4. Sum up all the filter impulse responses.
5. (optional) if it turns out that a lot of the resulting taps are close to zero, truncate.
• Hi Marcus, first of all thanks again for the super detailed explanation. I must admit that after spending an entire afternoon on trying to understanding this, I still don't quite get it completely. Nov 29 '18 at 1:12
• I will give these methods a try, but meanwhile I just want to clarify one thing: my problem from before is that the signal I want to apply the phase filter to is real recording and is rather complex. Hence there will always be frequencies that is not close to fs/length(filter) which results in leakage. To my understanding, this kind of leakage cannot be fully prevented by "oversampling". Do these methods you proposed resolve the frequency resolution completely? Or do I always have to find some kind of trade off? Nov 29 '18 at 1:16
• I don't understand the question. As you low-pass filter the power signal, not the signal itself, you simply get an averaged/smoothed effect. I'm not sure how you bring leakage into this. Nov 29 '18 at 10:47
• I guess what I'm trying to say is, I need the resolution of the frequency to be infinitely large instead of just some finite value. In that case, "oversampling" wouldn't help, would it? Nov 29 '18 at 18:42
• If this doesn't make sense don't worry about it. Let me take another look at your answer, maybe I didn't fully understand. Nov 29 '18 at 18:44