0
$\begingroup$

enter image description here

I want to downsample a finite section of an equidistant time-series $$x_i, \qquad i=0\dots n-1$$ by doing an FFT and dropping the upper part of the spectrum. Since the FFT looks at $x_i$ as a cyclic series, it will show edge effects (ringing) near $i=0$ and $i=n-1$ caused by for example a jump between $x_{n-1}$ and $x_0$ in the cyclic view. Hence I need to include some extra samples left of $x_0$ and right of $x_{n-1}$, i.e. take the indices $$i=-m\dots n-1+m$$ into the FFT, where the corresponding samples $x_{i<0}$ and $x_{i>n-1}$ are either accessible values (measurements) or respresent a reasonable extrapolation (e.g. zero-padding, $x=0$). The extra samples are dropped again once the downsampling is completed.

Now the question is, how many samples should I add? It is clear that the 'sinc' function, which represents the antialiasing cutoff (and hence, the edge ringing) is infinitely extended. So, I can, of course, not expect to obtain an exact solution from adding a finite set of samples. On the other hand, some quick examples show that adding just one sample on either side is not enough in most cases, since this only goes one half swing of the 'sinc' function towards the boundary values.

What heuristics could lead me to choose a reasonably appropriate number of extra samples (probably by specifying an accuracy parameter)?

The image above shows the result of a downsampled time-series that originally started at 1, but has been extended by a bunch of zeroes to the left. Since the ringing is not only determined by the sample rate but also by the height of the original step (in this case =1), it is not so easy to determine when the ringing (sinc) has dropped 'enough'. Imagine the step scaled by 1000, then the ringing is also scaled by 1000.

$\endgroup$
1
$\begingroup$

I want to downsample a finite section of an equidistant time-series by doing an FFT and dropping the upper part of the spectrum.

Why? This one of the least efficient way to down sampling. See Why is it a bad idea to filter by zeroing out FFT bins?

In order to down-sample you need to low pass filter first. There are many different ways of building a low pass filter and almost all of them are better than zero-ing FFT bins.

What heuristics could lead me to choose a reasonably appropriate number of extra samples (probably by specifying an accuracy parameter)?

You do this by first specifying the relevant requirements for your application: signal to noise ratio, phase distortion, pass band ripple, stop band ripple, latency, CPU/memory constraints. Some of those may be very important, some of those may be irrelevant, but it's different for each application. Then you design a filter that makes sure you meet your requirements.

$\endgroup$
2
  • $\begingroup$ I appreciate your opinion on using an ideal low-pass filter by zeroing the upper portion of the spectrum. Any other filter will introduce some amplitude distortion in the spectrum and my intention with the ideal low-pass was to avoid any of the per-application requirements you mentioned (because it is part of a general purpose data processing application). But I recognize that, by using a certain number of extrapolation samples, I am also building implicit requirements into the process. So I agree, it is probably better to specify the rq's explicitely. $\endgroup$ – oliver May 15 '20 at 10:35
  • $\begingroup$ What has finally convinced me that brickwall filtering is bad, is the following article about the Gibbs Effect: dspguide.com/ch11/4.htm $\endgroup$ – oliver May 15 '20 at 10:55

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.