Today’s Goals

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.

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

Advertisements

One thought on “Today’s Goals

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements
%d bloggers like this: