2
$\begingroup$

My question is: after upsampling a signal, does the output signal contain the original signal values? The diagrams I saw so far (on wikipedia and different forums) have always shown the original values but when I convolute with the fir filter coefficients, the output signal doesn't contain the original values or not all of them. Could that be a problem?

Thank you for your answer in advance!

$\endgroup$
1
  • $\begingroup$ Depends on the quality of your interpolation filter. If done correctly, the output signal should have values that are very close to the original values, yes. What is your interpolation filter? $\endgroup$
    – Jdip
    Feb 21 at 17:16

2 Answers 2

2
$\begingroup$

The output can contain the original values when a properly scaled linear phase interpolation filter is used that has an odd number of coefficients. This is because the group delay for a linear phase filter is $(N-1)/2$ where $N$ is the number of coefficients in the filter. For the same reason, an even length filter will have a half sample offset (at the output rate) in every output sample, so therefore cannot include any of the input samples directly.

To realize this condition, the filter should be designed as a $1/M$-band filter where $M$ represents the interpolation factor. (So a half-band filter for interpolate by 2, quarter band filter for interpolate by 4, etc.) When designed in this fashion as an odd length filter, the center coefficient will be maximum, and then spaced off of the center coefficient, every $M$th coefficient will be zero. This means for the condition when the input sample is aligned with the center coefficient of the filter, all other coefficients will be zero'd due the zero-stuffing prior to the filter, and all other samples will be aligned with the filter zero coefficients. Thus only the center tap, as the input sample, will be passed to the output. (This also assumes the filter coefficients are scaled such that the center tap is 1).

This is illustrated with the determined coefficients for a quarter-band filter (for an interpolate by 4 application) shown below. Such filter coefficients are easily determined by centering the frequency targets for passband and stopband on $1/M$ (in this case 0.25) using Least-Squares design tools such as firls in Matlab, Octave and Python scipy.signal (or Parks-McClellan, which is not recommended for high order interpolation and decimation filters due to the constant stop-band with consideration to aliasing).

coeff = 4 * sig.firls(31, [0, .24, .26, 1], [1,1,0,0])

interpolate by 4 filter

Often, multi-band filters are used for interpolation (and decimation) filter designs which concentrate rejection only where needed (at the signal images for the case of interpolation). These can also be designed as an odd-length filter such that the center coefficient is $1$ and every $M$th coefficient is zero, resulting in the input sample being passed to the output without modification.

$\endgroup$
1
$\begingroup$

Let's define your upsampling ratio to be $R \ \in \mathbb{Z}$ and that it's an integer.

If the interpolation filter has an impulse response that goes through zero at sample indices that are integer multiples of $R$, except for zero, then you can be guaranteed that the interpolated signal will go through the original sample points where they occur.

$$ y[n] = \sum\limits_{m=-\infty}^{\infty} x[m] h[n-Rm] $$

So for $y[Rm] = x[m]$ then

$$ h[n] = \begin{cases} 1 \qquad & n = 0 \\ \\ 0 \qquad & n = Rm \quad m \ne 0 \\ \end{cases} $$

That's what you need to happen. And that is satisfied with

$$ h[n] = \operatorname{sinc}(n/R) w[n] $$

where

$$ \operatorname{sinc}(u) \triangleq \begin{cases} \frac{\sin(\pi u)}{\pi u} \qquad & u \ne 0 \\ 1 \qquad & u =0 \\ \end{cases} $$

and $w[n]$ is a decent window function. I usually recommend Kaiser with a $\beta \approx 6$ or $7$.

$\endgroup$

Your Answer

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

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