Python Forum
Creating Data Set for Changing Oscillation Motion
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Data Set for Changing Oscillation Motion
#1
Hello,
I need to create a set of data points that are essentially x and y values for a graph of position vs time. the x values range from 0 to 40 in seconds and the y values correspond to changing oscillatory motion. For example from 0 to 5 seconds I want a wave function with a frequency of 0.5 Hz then from 5 to 10 seconds I want to increase the frequency to 1.0 Hz. My position is what is changing to mimic sinusoidal waveform similar to a mass on a spring starting from a position of zero.

I'm not as concerned with the amplitude i.e. it could be 1 to -1. I thought I could do this using interpolation but i'm not sure how.

This is how it was done for a more simple motion in the past:
def synth_sledge():
    seconds = np.arange(0, 15, 1/1000)
    #evenly spaced values within a given interval
    e = 0.00000001
    points = np.array([
        [0, 0],
        [0+e, 0],
        [5, 0],
        [5+e, 0],
        [15, 6],
        [15+e, 6],
        ])
    pos = scipy.interpolate.interp1d(points[:,0],points[:,1], kind='quadratic')(seconds)
    return seconds, pos

t, x = synth_sledge()
x=scipy.ndimage.gaussian_filter(x, 50)
I'm new to python so anything helps!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  motion tracking script ig? k4ne 0 467 Dec-13-2023, 02:00 AM
Last Post: k4ne
  Howto do motion event on solely window and not the widgets on it? janeik 3 837 Jul-11-2023, 12:10 AM
Last Post: deanhystad
  Issue in changing data format (2 bytes) into a 16 bit data. GiggsB 11 2,655 Jul-25-2022, 03:19 PM
Last Post: deanhystad
  I need help parsing through data and creating a database using beautiful soup username369 1 1,705 Sep-22-2021, 08:45 PM
Last Post: Larz60+
  Why changing data in a copied list changes the original list? plumberpy 3 2,225 Aug-14-2021, 02:26 AM
Last Post: plumberpy
  How can I scroll over my data points when creating plots in Python? (I'm using Spyder moose 0 1,603 Nov-02-2020, 07:18 AM
Last Post: moose
  Creating Complex Color Spectrum Plot From Data JoeDainton123 2 2,121 Sep-15-2020, 08:09 AM
Last Post: DPaul
  Detect event by motion/image - Help Zarqua 0 1,522 May-12-2020, 10:41 AM
Last Post: Zarqua
  Issue with creating an array of pixel data for PNG files in Google Colab The_Sarco 1 1,924 Apr-29-2020, 12:03 AM
Last Post: bowlofred
  Detection Motion Program Adek1243 11 4,353 Mar-23-2020, 10:12 AM
Last Post: Adek1243

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020