4
$\begingroup$

I want to up-sample my input signal by a factor of $2$. I saw zero padding followed by low pass filter method being used in few cases. But still I need some help in this.

  • Say I have $10$ input samples and my interpolating factor is $2$, then if I am doing interpolation using above method, will I get $20$ samples at the output?
  • Also how to increase the pass-band gain of the low pass filter to $6.02\textrm{ dB}$?
$\endgroup$
3
  • 2
    $\begingroup$ Please clarify what you mean by interpolation by zero padding. Zero padding itself does not interpolate your signal. It must be followed by a low pass filter, in which the entire art of interpolation rests. $\endgroup$
    – Phonon
    Commented Apr 23, 2013 at 5:49
  • $\begingroup$ @Phonon do you have any starting point (links or reference) for this art of design low pass filter for interpolation only. $\endgroup$ Commented Apr 23, 2013 at 10:39
  • $\begingroup$ For midpoint interpolation, see also Hamming, Digital Filters pp. 151-152 (straight up, no 0 insertion / lowpass). Try [-1 9 9 -1] / 16. $\endgroup$
    – denis
    Commented May 29, 2013 at 13:48

3 Answers 3

2
$\begingroup$

Looks like a bit of confusion here. Zero-padding (before an FFT) will provide interpolation in the frequency domain. Interpolation in the time domain is done (typically) by inserting zeros between samples and then applying a suitable low pass filter.

"Suitable" here depends highly on the requirements of your application, there is no "one size fits all" filter. Things to consider are passband ripple, phase distortion, residual aliasing, latency, stop band attenuation, causality, transient behavior, etc. Stanford's Julius Smith teaches a good course on the topic https://ccrma.stanford.edu/~jos/Interpolation/

$\endgroup$
2
$\begingroup$

When you upsample by a factor of two by inserting a zero between each sample you create an alias of your signal centered at the new Nyquist frequency (half the new sample rate). You get rid of the alias by low-pass filtering.

The specifications of the filter that you need depend on your signal. Say that your signal has one-sided bandwidth $B$ (by one-sided I mean that we are only talking about the positive frequencies, not the negative ones). $B$ must have been less than the Nyquist frequency of the old sample rate, $f_{sOld}$, to avoid aliasing.

Original signal

Once you upsample the alias appears.

Interpolated signal

Hopefully these pictures will help to gain an intuitive grasp of how to characterize the required low-pass filter. The passband must be flat from 0 Hz to $B$ Hz, and it must cutoff at $\frac{f_{sNew}}{2} - B = f_{sOld} - B$. The amount of attenuation that is required in the cutoff region depends on your application. Usually 50 dB is more than sufficient.

$\endgroup$
5
  • 1
    $\begingroup$ great picture, very helpful. I'd be carefully for blanket statements like "50 dB is usually sufficient". For most HIFI audio application this wouldn't be true. $\endgroup$
    – Hilmar
    Commented Apr 23, 2013 at 15:44
  • $\begingroup$ It's a nice picture, but I'm pretty sure it's misleading. The image of the 0 to $B$ will also appear from $f_{sOld}-B$ to $f_{sOld}$ in the first (pre-zero-insertion) picture, will it not? All that happens by inserting alternate zeros is that the effective sampling rate is increased... the representation in the frequency domain doesn't change (though there may be a scale factor). $\endgroup$
    – Peter K.
    Commented Apr 23, 2013 at 17:15
  • $\begingroup$ @PeterK. Yes and no. In a sense it is "there", but it is above the Nyquist frequency so it is indistinguishable from the original signal. Please see dsp.stackexchange.com/questions/1775/… $\endgroup$
    – Jim Clay
    Commented Apr 23, 2013 at 17:32
  • $\begingroup$ @Hilmar Thus the word "usually". $\endgroup$
    – Jim Clay
    Commented Apr 23, 2013 at 17:36
  • $\begingroup$ @JimClay The picture in the linked-to question is much clearer than the picture here (with the images below $f_{sOld}$ dotted / shaded rather than non-existent as they are(n't) here). The pictures here say there is NOTHING below $f_{sOld}$ or below $f_{sNew}$ which, as I said, is misleading (though I can see why you quibble). $\endgroup$
    – Peter K.
    Commented Apr 23, 2013 at 17:55
1
$\begingroup$

If you must zero-pad to do a 2X interpolation, one solution is to zero-pad around Fs/2 in the frequency domain, and then IFFT this 2X longer vector to produce the 2X longer time domain data.

Also, additional zero-padding in the time domain before the first FFT might help reduce circular convolution effects (assuming that that is less offensive than tapering to the padding level at the data edges).

$\endgroup$
2
  • 1
    $\begingroup$ Interpolating that way in the frequency domain is equivalent to using a "perfect" square filter that introduces ringing due to the Gibbs effect. $\endgroup$
    – Jim Clay
    Commented Apr 23, 2013 at 17:39
  • $\begingroup$ This is true if there is any spectral energy around the original Fs/2, which would cause problems (loss,ringing) with any interpolation filter. If there is no data around a filter's transition, then multiplying zero by either a rectangular edge or something like a raised-cosine taper produces nearly the same result, zero. $\endgroup$
    – hotpaw2
    Commented Apr 23, 2013 at 17:50

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.