resampling, interpolating matrix

前端 未结 8 1483
-上瘾入骨i
-上瘾入骨i 2020-12-17 22:02

I\'m trying to interpolate some data for the purpose of plotting. For instance, given N data points, I\'d like to be able to generate a \"smooth\" plot, made up of 10*N or s

8条回答
  •  我在风中等你
    2020-12-17 22:19

    This is upsampling. See Help with resampling/upsampling for some example solutions.

    A fast way to do this (for offline data, like your plotting application) is to use FFTs. This is what SciPy's native resample() function does. It assumes a periodic signal, though, so it's not exactly the same. See this reference:

    Here’s the second issue regarding time-domain real signal interpolation, and it’s a big deal indeed. This exact interpolation algorithm provides correct results only if the original x(n) sequence is periodic within its full time inter­val.

    Your function assumes the signal's samples are all 0 outside of the defined range, so the two methods will diverge away from the center point. If you pad the signal with lots of zeros first, it will produce a very close result. There are several more zeros past the edge of the plot not shown here:

    enter image description here

    Cubic interpolation won't be correct for resampling purposes. This example is an extreme case (near the sampling frequency), but as you can see, cubic interpolation isn't even close. For lower frequencies it should be pretty accurate.

提交回复
热议问题