3
$\begingroup$

Let's say you are given a frequency domain specification for a filter design.

As a simple example, let's use an ideal (brickwall) LPF. Now the impulse response of an ideal LPF is a $\operatorname{sinc}(\cdot)$ function which is infinite length and not causal. So to make it feasible you truncate it and shift it to the right. Now this shifting corresponds to a linear phase in the frequency response as follows:

$$H(e^{j\omega}) e^{-j\omega n_0}$$

Now if this $n_0$ is an integer then we do not have any problems in the time domain impulse response $h[n - n_0]$. But what if $n_0$ is not an integer which is entirely possible so how does that translate to the impulse response which cannot be defined for a non integer $n_0$ shift.

So what happens to the impulse response?

$\endgroup$

5 Answers 5

5
$\begingroup$

If you design a lowpass filter by windowing and shifting the impulse response of an ideal lowpass filter

$$h[n]=\frac{\sin(\omega_0n)}{\pi n}\tag{1}$$

then there's no other option than shifting the impulse response by an integer number of samples.

However, if for some reason you want a lowpass filter with a non-integer but constant delay, you could start with a delayed ideal lowpass filter:

$$h[n]=\frac{\sin(\omega_0(n-n_0))}{\pi (n-n_0)}\tag{2}$$

In this case the delay $n_0$ can be any real number. You can obtain an implementable filter by truncating/windowing the impulse response in $(2)$ such that it is causal and has a finite length. But note that in general the resulting filter won't have an exactly linear phase, but it will approximate a linear phase.

I designed six FIR filters with $100$ coefficients by simply truncating the delayed ideal impulse response in $(2)$ with $\omega_0=0.4\pi$ and with six different values for $n_0$: [49.0, 49.1, 49.2, 49.3, 49.4, 49.5]

The figure below shows the passband group delays of these six filters. Clearly, the filters with $n_0=49.0$ and $n_0=49.5$ samples have an exactly linear phase, while the others only approximate a linear phase (i.e., a constant group delay).

enter image description here

Note that in general the delay of a linear phase FIR filter can only be either an integer value of samples or an integer value plus $\frac12$. The value of that delay is determined by the filter length $N$ (the number of filter taps), and it equals $(N-1)/2$ samples.

Also take a look at this related question and its answers.

$\endgroup$
8
  • $\begingroup$ So essentially if for someone reason I get $n_0 \neq$ an integer or an integer $+1/2$ then I would merely get an approximation of a linear phase. But why does $+1/2$ also work? $\endgroup$ Apr 6, 2023 at 21:09
  • $\begingroup$ @AhsonYousef: If $2n_0$ is not an integer then the filter can only have an approximately linear phase. A delay of $\frac12+k$, $k\in\mathbf{Z}$, is possible because for exactly linear phase you need symmetry in the impulse response. If you have an odd number of coefficients, e.g., h=[1,2,1] you get an integer delay, and if you have an even number of coefficients, e.g., h=[1,1] you'll have a non-integer delay. For the example h=[1,1] the delay is $\frac12$. $\endgroup$
    – Matt L.
    Apr 7, 2023 at 5:55
  • $\begingroup$ I apologize for pestering you again and again and I do appreciate your answer, however, the question that I had in my mind boils down to the following: Does $F^{-1}\{H(e^{j\omega}) e^{-j\omega n_0}\}$ exist for a non-integer $n_0$? I believe it does but how can it be then defined as a discrete time signal, $h[n]$? $\endgroup$ Apr 7, 2023 at 8:07
  • $\begingroup$ @AhsonYousef exists, but not for filters with finitely many taps! $\endgroup$ Apr 7, 2023 at 8:14
  • $\begingroup$ @AhsonYousef: This inverse Fourier transform is exactly what I wrote as Eq. (2) (if the magnitude is an ideal lowpass filter). So it exists, but it is non-causal and unstable. $\endgroup$
    – Matt L.
    Apr 7, 2023 at 8:35
2
$\begingroup$

A fractional delay is just an integer delay at a sufficiently high sample rate.

Thus, the problem of fractional delay could be thought of as 1)Ideal upsampling (potentially to a continuous waveform), 2) delay, 3) Ideal downsampling (or sampling).

Thus ideal fractional delay could be a question of ideal resampling. Which (unfortunately) tends to involve sinc functions and infinite delay/complexity.

$\endgroup$
1
  • $\begingroup$ This is exactly how my professor explained it a few weeks after I asked this question. However, I have a question about the statement: potentially to a continous waveform. Shouldn't it always be reconstructed to a continuous waveform and then sampled at a higher rate? How is it possibe without doing so? $\endgroup$ May 14, 2023 at 20:19
1
$\begingroup$

Recommended reading on the topic: https://ieeexplore.ieee.org/document/482137

Delaying is a linear operation and we express the process as convolution with a "delay filter", i.e.

$$h[n-x] = h[n]*\Delta[n-x]$$

where $\Delta[n-x]$ is the impulse response of a pure delay of "x". Turns out the impulse response of a pure delay is also a sinc function, i.e.

$$\Delta[n-x] = \text{sinc}[n-x]$$.

If the delay is an integer, (i.e. $ x = n_0, n_0 \in \mathbb{Z}$), than the this turns simply into a delayed unit impulse response (or Kronecker delta ) since the sinc for an integer argument is 0 except for $\text{sinc}[0] = 1$.

Fractional delays can be done, but they are awkward since (like an ideal lowpass filter) the impulse response is infinitely long and infinitely non-causal. Any practical application can only do an approximation using truncation and/or windowing using a complex trade off between latency, phase error, amplitude error, computational cost, etc.

$\endgroup$
0
$\begingroup$

I'd like to add a response as I just computed some stuff, which hopefully is correct, but everything adds up, so I am hopeful!

I assume a system response $H(e^{j\omega}) = e^{-j\phi(\omega)}$, so a generic allpass. Furthermore some generic input signal spectrum $X(e^{j\omega }) = \sum_{k=-\infty}^{\infty}x(k)e^{-j\omega k}$ and the corresponding output spectrum $ Y(e^{j\omega}) = X(e^{j\omega}) H(e^{j\omega})$.

We are interested in the output signal $y(n)$ and how it relates back to $x(n)$. First, I will not assume a special form of the phase response. Generally, we obtain

$y(n) = \frac{1}{2\pi} \int_{-\pi}^{\pi} Y(e^{j\omega})e^{j\omega n}d\omega = \frac{1}{2\pi} \int_{-\pi}^{\pi} e^{-j\phi(\omega)} \sum_{k=-\infty}^{\infty}x(k)e^{-j\omega k} e^{j\omega n}d\omega = \frac{1}{2\pi}\sum_{k=-\infty}^{\infty}x(k)\int_{-\pi}^{\pi} e^{-j\phi(\omega)} e^{j\omega (n-k)}d\omega$

Because $\phi(\omega)$ is periodic with period $2\pi$, we can expand $e^{-j\phi(\omega)}$ into a Fourier series, and actually, we see the computation of some fourier coeffients in the final integral.

For a function $f$ with a period of $2\pi$ and the complex fourier series, we have the general formular $ c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(\omega)e^{-j\omega n}d\omega$ for the fourier coefficients. I assume $f$ is such, that the integral exists.

Now we obtain further

$ \frac{1}{2\pi}\int_{-\pi}^{\pi} e^{-j\phi(\omega)} e^{j\omega (n-k)}d\omega = \overline{\frac{1}{2\pi}\int_{-\pi}^{\pi} e^{j\phi(\omega)} e^{-j\omega (n-k)}d\omega} = \overline{c_{n-k}(e^{j\phi(\omega)})}$

where $c_{n-k}(e^{j\phi(\omega)})$ denotes the fourier coefficients of $e^{j\phi (\omega)}$.

Now, using the relation $c_n(\overline{f}) = \overline{c_{-n}(f)}$, where $\overline{\cdot}$ denotes the complex conjugate, we obtain

$\overline{c_{n-k}(e^{j\phi(\omega)})} = \overline{c_{-(-n+k)}(e^{j\phi(\omega)})} = c_{k-n}(\overline{e^{j\phi(\omega)}}) = c_{k-n}(e^{-j\phi(\omega)})$

It follows

$ y(n) = \sum_{k=-\infty}^{\infty}x(k)c_{k-n}(e^{-j\phi(\omega)}).$

So we obtain $y(n)$ by convolving the input signal with the time reversed fourier coefficients of the system's transfer function. Now, this equation yields the well known result for a linear phase response (try it out, the fourier coefficients are obvious). However, if we have $\phi(\omega) = r\omega$ with real, noninteger $r$, we can compute, that this phase response indeed phase shifts the input signal by $r$ samples: the fourier coefficients of $e^{-jr \omega}$ are

$ c_n(e^{-j r\omega}) = (-1)^n \frac{sin(\pi r)}{\pi (n+r)}$.

Pluggin this into the previous equation, we get

$y(n) = \sum_{k=-\infty}^{\infty} x(k) c_{k-n}(e^{-j r\omega}) = \sum_{k=-\infty}^{\infty} x(k) (-1)^{k-n} \frac{sin(\pi r)}{\pi (k-n + r)}$

Using $ (-1)^{k-n}sin(\pi r) = sin(\pi r + \pi (k-n))$, we can actually see, that this formular is just shannon's interpolation formular with sampling period $T=1$ and some index changes. Therefore, if you filter an input signal with the system $H(e^{j\omega}) = e^{-j r \omega}$, it delays the input by an amount of $r$ samples, i.e., it is as if the input signal is interpolated using shannongs formular, shifted (delayed) in continous time domain by $r$, and then resampled with a period of $T=1$.

This is what some other people have said, and what you can find elsewhere on the internet, however, I have never seen it actually being calculated. It is missing from typical signal processing tables.

I hope I did not make a mistake :D

$\endgroup$
0
$\begingroup$

I don't think I had seen this question before today. If it's essentially how to find the coefficient set for a pure bandlimited delay of a non-integer number of samples, we first break the delay into the sum of an integer and fractional component. The integer component tells you which $L$ adjacent samples that are linearly combined and the fractional part tells you what the $L$ coefficients are to combine the samples. Even if the filter kernel is not a windowed-sinc function, that's the mechanism. Integer part - which samples. Fractional part - which coefficients.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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