Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is upsampling. See <a href="https://stackoverflow.com/questions/5156690/help-with-resampling-upsampling">Help with resampling/upsampling</a> for some example solutions.</p> <p>A fast way to do this (for offline data, like your plotting application) is to use FFTs. This is what SciPy's native <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.html" rel="nofollow noreferrer"><code>resample()</code> function</a> does. It assumes a periodic signal, though, <a href="http://flic.kr/p/ax62fP" rel="nofollow noreferrer">so it's not exactly the same</a>. See <a href="http://www.embedded.com/design/other/4212939/Time-domain-interpolation-using-the-Fast-Fourier-Transform-" rel="nofollow noreferrer">this reference</a>:</p> <blockquote> <p>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.</p> </blockquote> <p>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:</p> <p><img src="https://i.stack.imgur.com/1CtHr.png" alt="enter image description here"></p> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload