python - resampling, interpolating matrix -


I am trying to gather some data for the purpose of plotting. For example, N data points are given, I want to be able to generate a "smooth" plot, which is composed of 10 * N or so many data points.

My approach calculates an N-by-10 * N matrix and internal product to the original vector and matrix, which provides 1-by-10 * N vector. I have already prepared the math which I want to use for the interpolation, but my code is very slow. I am very new to the dragon, so I hope some experts here can tell me a few ways, I can try to speed up my code.

I think the part of the problem is that for generating the matrix, the following function requires 10 * N ^ 2 calls:

  def sinc ( X): Try import calculation: Excluding return math.sin (math.pi * x) / (Mathematics. X * x) Zero Divination Error: Return 1.0  

(This original By the way, I am trying to recreate a signal from my samples, and it increases it in high frequency.)

DIF Replametics (TSO, SSF, O, F): From the MMP import array as NMP relay = [I] in range (F): Retval. Render (O)]) Return Anper (Retal)

I'm considering breaking into small pieces Because I do not like the idea of ​​en ^ 2 matrix sitting in memory. I might have a 'generator function' in 'Response' Number to build metrics and internal product can also line-per-line go, but I do not think until I paging stuff will be very fast my code to memory and then will not start.

Thank you in advance for your suggestions!

This is an upsurge for some examples solutions.

A faster way to do this (for offline data, such as the application of your plotting) is to use FFT, that is what makes SciPy original, it considers a periodic sign, however, See:

Here is the second issue about time-domain real signal launch, and in fact this is a great deal. This exact interpolation algorithm provides the correct results only if the original X (N) sequence is periodic within the full-time interval.

Your function assumes that the samples of the signal are all outside the defined range, so in two ways different from the center point, if you pad the signal with too many zeros , Then it will give very close results. There are several zeros at the side of the plot shown here:

Enter image details here

Cubic interpolation will not be right for the rotating purposes. This example is an extreme condition (near the sample frequency), but as you can see, the cube interpolation is also not close enough for low frequencies it should be very accurate.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -