1D interpolation of synthesized sampled data.

**python* → corresponds to my python environment which is iPython with NumPy, SciPy, Matplotlib installed in a Virtualenv.**

I’m starting by selecting values from the elbow’s rotation sampled values that indicate periodicity. This was 20 values (frames at 24 fps). I multiplied this by three to get 60 sampled points. Now, I’m going to interpolate these values and then resample at a much higher rate. I will then run an fft on the larger pool of values in order to better approximate the function.

*Here goes…*

The Shannon-Nyquist theorem states, “*If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart*.” Therefore, and my understanding might be off, but I think that since my signal’s period is 20 frames at 24 fps (1.20 Hz), which can be determined by eye-balling the signal, I need to sample at a rate greater than 2 times 1.20 Hz (2.4Hz). My samples from the video source are already 1/24fps –> 24Hz. However, to be on the safe side, I’m going to sample the hell out of this signal. I’ll choose 32786 samples.

For the fft to work, the number of samples, N, should be equal to 2^k, k being an arbitrary number as long as the Nyquist sampling theorem holds. I’ll choose k to be 15 and get 32786 samples (N) through a cubic interpolation of the original discrete sample (values from rotoscoping at 24Hz). I want a lot of points so that I can run an fft and get the frequencies needed to synthesize the signal.

- Read in the csv file to python* and store the original 60 data points in an array.
- Using these original data values, create a function that runs a 1D interpolation using the “cubic” kind parameter.
- Create a new array of sample positions, “xnew = np.linspace(0, 59, 32768)”. This assumes that numpy has been imported as np.
- Generate the sample values by running the interpolation function at each xnew value and storing the result in ynew.
- Graph the function and make sure you’re seeing the graph you started with.

Next up: take the discrete fourier transform to obtain the fourier series. Here are some links to check out.

http://glowingpython.blogspot.com/2011/08/how-to-plot-frequency-spectrum-with.html

http://docs.scipy.org/doc/numpy/reference/routines.fft.html

https://www.google.com/search?q=fitting+functions+fft&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

http://www.sciencedirect.com/science/article/pii/0029554X73903145