Could I downsample a series of length 10 to length 7, with even distribution? i.e. Numbers get split across two (neighbouring) resultant numbers, as opposed to one result being a combination of 1 number, and another result being a combination of 2. i.e. All numbers be a combination of 10/7 numbers.

For this example, with my current - naive - approach, some of the 7 "buckets" would average 1 number, and some other buckets would average 2 numbers: avg(1), avg(2, 3), avg(4), avg(5, 6), avg(7), avg(8, 9), avg(10)

Would the solution be something like: weighted_avg((1, 1), (2, 10/7 - 1)), weighted_avg((2, 1), (3, 10/7 - 1)), ...

where weighted_avg = ((value_x_1, weighting_1), (value_x_2, weighting_2)) -> weighted average


1 Answer 1


Absolutely positively -- uh -- maybe.

It depends entirely on the underlying process that generated the original series, what the series "means", how much unique information is actually present in those ten samples, how much you're willing to throw away, and what you know about how that information is structured.

At the extreme "no" end would be if those ten data points were essentially completely random -- i.e., if you recruited ten people on the street and asked them their favorite number, then there's no way of relating the 1st sample to the second.

The trivial extreme "yes" would be if those ten data points were super highly correlated -- the altitudes of ten points a meter apart on a nice smooth sidewalk, for instance. Then your proposed simple interpolation scheme would work quite nicely.

What you're trying to do is a generalization of downsampling. If you had an infinite sequence of points that it made sense to describe in the frequency domain, then as long as the sequence was band-limited to less than 7/20th of the original sampling rate, you could upsample by a factor of 7, filter the resultant signal, then downsample it by a factor of 10.

You can't do that, because filters suffer from end effects, and from the point of view of the necessary filters, your data sequence is all end and no middle.

The absolute best formal way to do the job would be to understand whatever the underlying process that generated those ten points. From that, figure out how to work backward to the most likely location or the seven points, and voila, you either have an answer or your loved ones retrieve your body from under a mountain of scribbled on paper and give you a decent burial.

A pretty good ad-hoc way to do this, if you have reason to believe that those ten points represent some sort of a bandlimited process, is to just use a set of splines to make a smoothed line between the ten points, and then sample that line at the seven points. This really only works well if the underlying process happens to match up well with a spline -- but if it's bandlimited it does -- and if it's something like the positions of a beam at those ten points then it definitely does, because the mathematical sort of spline is a pretty good simulation of the draftsman's spline, which is a beam that's pinned down at certain points to make a sparse set of points into a nice smooth curve, for boatbuilding.

  • $\begingroup$ +1 for good answer and humor too $\endgroup$ Sep 14, 2020 at 2:23

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.